#include <stdio.h>

/* Terry Harvey CISC105 Section 21 TA Aaron*/

/* Sample program for demonstrating an if statement */

int main(){

    double tempF; //temperature in Fahrenheit
    double height; //height in feet (note whitespace after declarations)

    printf("Enter a temperature: ");
    scanf("%lf", &tempF);
    printf("Enter a height: ");
    scanf("%lf", &height);

    /* We could also use "scanf("%lf%lf", &tempF, &height);" but we
       would need to change the prompt too. Why?  */

    /* Notice that the format control statement for scanf has no
       characters but the format specifier(s). This helps avoid errors. */

    /* Note the block after the "if", bounded by braces. Why is it
       there? */

    if (tempF > 99) {
        printf("Call the morgue, "); 
        printf("Patient is about to die.\n");
    }
    else /*the else must immediately follow the "if" that it goes with */
        printf("Patient will live a while yet.\n");

    /* Can you write some more complex if statements? */

    /* What if we replaced the "else" with "if (tempF <= 99)"? Would
       the meaning be the same? Try it. Why is using "else" better? */

    printf("tempF is: %lf F, height is: %lf ft", tempF, height);
    printf("\n");
    return 0;
}
