CSCI 1300 - Programming Homework 1
Temperature Conversion
Due Thursday, Jan 25 at 11:55pm

Homework Policy [CAUTION!]

For programming assignments, you may consult with others (instructors, other students, etc.). You may look at and discuss algorithms or programs that are under development provided that you do not make a copy of any code in any way (no file copying, no xerox copies, no copying by hand, etc.), nor may you allow another student to make a copy of your code. You may also use any references (books, web, etc.) provided that include a comment that cites any resources used (not needed for our textbook)

As a student, you are responsible for knowing and adhering to this policy. Violations will be reported to the CU Honor Code Council and result in an F for the entire course.

Temperature Conversion

The purpose of Assignment 1 is to make sure that you know how to write a small program that reads some information, does a calculation, and prints results that are based on that calculation.

Write a short program called temperature.cxx to calculate temperature conversions as described below.

Input. The program asks the user for these pieces of information:

  1. A single number with data type double. This is the temperature to convert.
  2. A single character which must be F, C, or K. This character indicates whether the is a Fahrenheit, Centigrade or Kelvin temperature.
The program must write a single prompt for both items and read them in the order listed above.

Output. The program then prints messages with this information:

  1. The equivalent temperature in all three temperature scales (Fahrenheit, Centigrade and Kelvin). These output numbers should be rounded to two decimal places (as shown in class during the first week). Each temperature must be on a separate line with the letter F, C or K following the temperature. These three output lines must be in the order of F (first), C (second) and K (third).
  2. A message about the temperature. The message must be one of these: The only output should be the items listed above (otherwise we won't be able to grade your program).

Sample Input:


Sample Output:

You are a fugitive from the law of averages.


// The program must have a comment at the top that lists the
// name of the source file, the name and e-mail address of the
// student, the current date, and a short description of the
// purpose of the program.

Each variable declaration must include a comment indicating the purpose of the variable. All these declarations must be at the top of the main function (right after int main( )).

The program must return EXIT_SUCCESS to the operating system.

Check that the program compiles and runs correctly. Submit the program to