All pastes #156622 Raw Edit

Bad if statements

public c v1 · immutable
#156622 ·published 2006-08-31 21:47 UTC
rendered paste body
#include <stdio.h>//Program to convert celsius to fahrenheit or vis versa.int main (void) {        char unit[9];    double tempc, tempf;    double toc, tof;        printf("Would you like to start with Celsius or Fahrenheit?\n");    scanf("%s",&unit);        printf("What temperature?");    if (unit=="Celsius")        scanf("%lf", &tempc);    else        scanf("%lf", &tempf);                    tof=1.8*tempc + 32;    toc=(tempf-32)/1.8;               if (unit=="Celsius")       printf("That temperature converts to %.0f degrees Fahrenheit.\n", tof);    else       printf("That temperature converts to %.0f degrees Celsius.\n", toc);                 system("pause");    return 0;}