Assignment 3

due at 6pm on Mon 26 Sep

Write a program that will ask the user to type in a temperature in the Celsius scale, and print out the corresponding temperature in Fahrenheit. If the Fahrenheit temperature is under 35, it should say “that’s cold!“, or if it’s over 90, it should say “that’s hot!“.

Here are three sample runs. The user can type whatever temperature he/she wants, so don’t rely on just these.

  Enter temperature (C): 40
  40.0 degrees Celsius is 104.0 degrees Fahrenheit.
  That's hot!
  Enter temperature (C): 1.4
  1.4 degrees Celsius is 34.5 degrees Fahrenheit.
  That's cold!
  Enter temperature (C): 19
  19.0 degrees Celsius is 66.2 degrees Fahrenheit.

You should use variables such as temp_c and temp_f. To convert Celsius to Fahrenheit, multiply by 1.8 and then add 32.

Submit your program by attaching the .cpp file to an email message.

©2011 Christopher League · some rights reserved · CC by-sa