File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ #define INCHES_PER_CENTIMETER 0.394
2
+ #define CENTIMETERES_PER_INCH 1 / INCHES_PER_CENTIMETER
3
+
4
+ #define QUARTS_PER_LITER 1.057
5
+ #define LITERS_PER_QUART 1 / QUARTS_PER_LITER
6
+
7
+ #define OUCES_PER_GRAM 0.035
8
+ #define GRAMS_PER_OUNCE 1 / OUCES_PER_GRAM
Original file line number Diff line number Diff line change
1
+ /* Program to illustrate the use of the #include statement
2
+ * Note: This program assumes that definitions are
3
+ * set up in a file called metric.h */
4
+
5
+ #include <stdio.h>
6
+ #include "metric.h"
7
+
8
+ int main (void )
9
+ {
10
+ float liters , gallons ;
11
+
12
+ printf ("*** Liters to Gallons ***'\n\n" );
13
+ printf ("Enter the number of liters: " );
14
+ scanf ("%f" , & liters );
15
+
16
+ gallons = liters * QUARTS_PER_LITER / 4.0 ;
17
+ printf ("%g liters = %g gallons\n" , liters , gallons );
18
+
19
+ return 0 ;
20
+ }
You can’t perform that action at this time.
0 commit comments