|
|
 |
|
|
|
|
info.open(indata.data);
info >> m >> n;
cout << The sum of < m < and < n
< is < m+n << endl;
return 0;
} |
|
|
|
|
|
|
|
|
1. Using a top-down design, write a C++ program that inputs a single letter and prints out the corresponding digit on the telephone. The letters and digits on a telephone are grouped this way: |
|
|
|
 |
|
|
|
|
2=ABC 4=GHI 6=MNO 8=TUV |
|
|
|
 |
|
|
|
|
3=DEF 5=JKL 7=PRS 9=WXY |
|
|
|
 |
|
|
|
|
No digit corresponds to either Q or Z. For these two letters, your program should print a message indicating that they are not used on a telephone. |
|
|
|
|
|
|
|
|
The program might operate like this: |
|
|
|
 |
|
|
|
|
Enter a single letter, and I will tell you what the corresponding digit is on the telephone. R The digit 7 corresponds to the letter R on the telephone. |
|
|
|
 |
|
|
|
|
Enter a single letter, and I will tell you what the corresponding digit is on the telephone. Q There is no digit on the telephone that corresponds to Q. |
|
|
|
 |
|
|
|
|
Your program should print a message indicating that there is no matching digit for any nonalphabetic character the user enters. Also, the program should recognize only uppercase letters. Include the lowercase letters with the invalid characters. |
|
|
|
 |
|
|
|
|
Prompt the user with an informative message for the input value, as shown above. The program should echo-print the input letter as part of the output. |
|
|
|
 |
|
|
|
|
Use proper indentation, appropriate comments, and meaningful identifiers throughout the program. |
|
|
|
|
|
|
|
|
2. People who deal with historical dates use a number called the Julian day to calculate the number of days between two events. The Julian day is the number of days that have elapsed since January 1, 4713 B.C. For example, the Julian day for October 16, 1956, is 2435763. There are formulas for computing the Julian Day from a given date and vice versa. |
|
|
|
|
|