-
Write a program that asks the user to enter an integer and then a double.
Then echo the entered data to the screen. The interaction should appear as
follows:
Enter an integer:
9
Enter a double:
5.3
You entered the integer 9 and the double 5.3.
Save this program as the filename lab02_1.cpp
-
Copy the program you just made and do the following modifications. Remove
the "You entered" line and instead output the following calculations, one
output per line:
- The integer times the integer 10.
- The double times the integer 10.
- The integer times the double.
The output should appears as follows:
Enter an integer:
9
Enter a double:
5.3
The value of 9 * 10 is 90.
The value of 5.3 * 10 is 53.
The value of 9 * 5.3 is 47.7.
Save this program as the filename lab02_2.cpp
-
Copy the program from 1 again and remove the "You entered" line. Add a second
double variable. Assign the double variable the following values and print it
to the screen:
- Assign it the result of the integer divided by 5.
- Assign it the result of the integer divided by 5.0.
- Assign it the result of the double divided by 5.
- Assign it the result of the double divided by 5.0.
The output should be:
Enter an integer:
9
Enter a double:
5.3
9 / 5 is 1.
9 / 5.0 is 1.8.
5.3 / 5 is 1.06.
5.3 / 5.0 is 1.06.
Save the program as the filename lab02_3.cpp
Email all three files to my Helios account.