Assignment C

Primary focus on chapters 2 Introduction to C++ and 3 Expressions and Interactivity

For each problem:

Problem C1

Create a program that asks the user for a temperature in Celsius, computes the corresponding temperature in Fahrenheit, and then prints the temperature in Celsius and Fahrenheit.

To convert from Celsius to Fahrenheit use the mathmetical formula:

  
      Fahrenheit  =  Celsius  *  9/5  +  32
    

Use named constants; do not put numbers down in the code.
You need to include the iostream and iomanip libraries.
The execution result should have three lines each time the program is run:

  1. The input line
  2. Celsius: followed by the value from the input, with one decimal position.
  3. Fahrenheit: followed by the value converted from the input, with one decimal position.

Align the decimal points for the two lines that print the Celsius and Fahrenheit temperatures.

Test data, run the program three times:
First test input 37.778 degrees Celsius
Second test input -40 degrees Celsius
Third test input 0 degrees Celsius

Problem C2

Prompt the user to type a name.
Use getline to read all the characters input by the user, and save these characters in a string variable.
Print the line you read.

Test the program twice:
First with the name: George Washington
then with the name: Franklin Delano Roosevelt

Problem C3

Prompt the user to type a first and last name in one line.
Read and save the first character in the first name and omit the rest of the first name.
Read and save the first character in the last name and omit the rest of the first name.
Print these initials.

Hint: Read the first character, then read the rest of the first name as a string, then read the next character. Only print the two characters.

Test the program with the name: Harry Truman