Lexington High School Mathematics Math Dept. Front Page  | Student Links  | Family Links 
Introduction to C++, Kevin Kelly Kelly Front Page  | C++ Course Guide | C++ Assignments | C++ Info

Assignment 4: Temperature converter

due Wednesday 2/6

This is the first assignment that will be graded. (Assignments 1 and 2 were just checked for completion). Here is an explanation of the scoring criteria.

Write a program that asks the user to enter a temperature in degrees Fahrenheit, then prints out the equivalent temperature in degrees Celsius.

Temperatures aren't always whole numbers (example: body temperature 98.6°F) so use decimal numbers and float variables in this program.

For the sample output you hand in, run the program at least twice, including once with a decimal number as the input.




Extensions

For 5 points: Make your program round off the Celsius temperature to the nearest tenth (example: 23.8° Celsius). See "Output Formatting" in textbook section 3.9 for help.

For 5 more points: Besides everything described above, also write a second program that prints out a °F to °C conversion table. Show temperatures from -50.0°F to 120.0°F in 10.0° increments.