british-cars
[Top] [All Lists]

secret decoding of Dale C.s' age

To: british-cars@alliant.Alliant.COM
Subject: secret decoding of Dale C.s' age
From: mit-eddie!mozart.AMD.COM!zahid@EDDIE.MIT.EDU (Zahid Ahsanullah)
Date: Tue, 31 Jul 90 14:29:32 CDT
In a recent posting our founder Dale Cook mentioned that he now
keeps tab on his age by going celsius. This is for those who
are trying to figure out what 10.5 celsius is really around at.
Sorry Dale, just couldn't help it.

                        Cheers
                        Zahid


Compile the following `c' code and execute it typing "tempc".
This'll give you the help message.


                /* program tempc converts temperature */
main(argc,argv)
int     argc;
char    *argv[];
{
int     fahrenheit=1;           /* default to fahrenheit */
float   fahr, celsius;

        if (argc<2) {
                printf ("\n     temperature units conversion\n");
                printf ("       written by Zahid Ahsanullah\n\n");
                printf ("       Usage: tempC [-c] <temperature>\n");
                printf ("              -c: celsius to fahrenheit.\n");
                printf ("                  Default is vice versa\n");
                exit(0);
                }
        if (strcmp (argv[1], "-c") == 0) 
                        fahrenheit = 0;
        
        if (fahrenheit) {
                sscanf (argv[1], "%f", &fahr);
                celsius = (5.0/9.0) * (fahr-32.0);
                printf("%6.1f celsius\n", celsius);
                }
        else {
                sscanf (argv[2], "%f", &celsius);
                fahr = (9.0 * celsius / 5.0) + 32.0;
                printf("%6.1f fahrenheit\n", fahr);
                }
}


<Prev in Thread] Current Thread [Next in Thread>