Annotation of 43BSD/usr.lib/learn/C/L2.1a, revision 1.1.1.1

1.1       root        1: #print
                      2: (Section 1.2)
                      3: The file Ref.c contains a copy of
                      4: a program to convert Fahrenheit to
                      5: Celsius. Modify it to print this
                      6: heading at the top:
                      7: Fahrenheit-Celsius Conversion
                      8:   F:     C:
                      9: Type ready when you're satisfied.
                     10: #once #create Ref
                     11: Fahrenheit-Celsius Conversion
                     12:   F:     C:
                     13:    0  -17.8
                     14:   20   -6.7
                     15:   40    4.4
                     16:   60   15.6
                     17:   80   26.7
                     18:  100   37.8
                     19:  120   48.9
                     20:  140   60.0
                     21:  160   71.1
                     22:  180   82.2
                     23:  200   93.3
                     24:  220  104.4
                     25:  240  115.6
                     26:  260  126.7
                     27:  280  137.8
                     28:  300  148.9
                     29: #once #create Ref.c
                     30: /* print Fahrenheit-Celsius table 
                     31:        for f = 0, 20, ..., 300 */
                     32: main()
                     33: {
                     34:        int lower, upper, step;
                     35:        float fahr, celsius;
                     36: 
                     37:        lower = 0;      /* lower limit of temperature table */
                     38:        upper = 300;    /* upper limit */
                     39:        step = 20;      /* step size */
                     40: 
                     41:        fahr = lower;
                     42:        while (fahr <= upper) {
                     43:                celsius = (5.0/9.0) * (fahr-32.0);
                     44:                printf("%4.0f %6.1f\n", fahr, celsius);
                     45:                fahr = fahr + step;
                     46:        }
                     47: }
                     48: #user
                     49: a.out >x
                     50: #cmp Ref x
                     51: #fail
                     52: Make sure you get the spacing right.
                     53: #log
                     54: #next
                     55: 2.1b 10

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.