Assignment 2

The purpose of this assignment is to compose a program using variables, input, and output.

Due Monday 17 September at 1 am

Description

Your program should:

  • Ask the user to type in a temperature in degrees Celsius (°C). The temperature is allowed to have a decimal point.

  • The program will then convert that value into degrees Fahrenheit (°F) and output it rounded to just one decimal point of precision. As we learned in class, the following statements will set up cout to print with one decimal point of precision:

    cout.setf(ios::fixed);
    cout.precision(1);
  • To convert °C to °F, multiply by 1.8, then add 32.

  • Please write your program in temp.cpp in a folder called a02 within cs102. (You may have to create that folder yourself.)

Examples

Here are some sample runs of the program:

Enter temperature (C): 28
That is 82.4 F.
Enter temperature (C): 0
That is 32.0 F.
Enter temperature (C): 100
That is 212.0 F.
Enter temperature (C): -2.4
That is 27.7 F.
A weather app using °C

A weather app using °C