Lab 2 Part I: Due 1 pm, Tuesday, Sep 12
Write a C++ program which takes 3 numbers of type double from the user and prints out the numbers in ascending order, one number per line. The program should let the user repeat this as long as s/he wants. A sample dialogue should look like this:
Please enter 3 numbers
3.14 2.71 -1.41
The numbers in ascending order are
-1.14
2.71
3.14
would you like to do this again?
........
Lab 2 Part II: Due 1 pm Tuesday, Sep 12
Write a program that reads a letter A-Y (in uppercase) and prints the corresponding telephone digit according to the following rule:
A, B and C converted to 2
D, E, and F converted to 3
G, H, and I converted to 4
J, K, and L converted to 5
M, N, and O converted to 6
P, R, and S converted to 7
T, U and V converted to 8
W, X and Y converted to 9.
There is an outline of this program in the class folder (under "Course Material\FilesForLabs"). Start with that and fill in the gaps. ( You may find the following fact about character data type to be useful: characters can be compared. For instance if letter is a character variable holding the value of 'C' then letter > 'B' returns True)
Here is a sample run of this program:
This program converts uppercase letters to their corresponding telephone digits.
To stop the program enter Q or Z.
Enter a letter --> A
The letter you entered is --->A
The corresponding telephone digit is ---> 2
Enter another uppercase letter to be converted to a telephone digit.
To stop the program enter Q or Z.
Enter a letter --> D
The letter you entered is ---> D
The corresponding telephone digit is -->3
Enter another uppercase letter to be converted to a telephone digit.
To stop the program enter Q or Z.
Enter a letter --> Q
Do programming projects 13 and 14 at the end of chapter 3 (pages 176-7)