Computer Programming I
Lab #5 - ASCII Charts
THE PROBLEM: Design and write a program in C++ that will write out all the printable characters in the Ascii chart with their corresponding Ascii code values. This means the characters numbered 32 through 127, inclusive. The program must have a repeating menu (using a switch statement) with instructions that allow the user to dump out the Ascii chart using a while loop, a do-while loop and a for-loop. Non-printable characters (below 32 or above 127) should be skipped, but the rows should still line up neatly. In each case, the chart should look neat and readable, and each version of the chart should appear to be identical, except for a title at the top identifying which type of loop produced the chart. One option on the menu should allow the user to exit the program.
Example:
ASCII Chart Using While-Loop:
32= 33=! 34=" 35=# 36=$ 37=% 38=& 39='
40=( 41=) 42=* 43=+ 44=, 45=- 46=. 47=/ 48=0 49=1
.
.
.
etc. (to char 127)
THE DESIGN: Recall the steps in problem-solving, go through each one in this project. Your top-down design, written in your program comments, must be complete. Your design will be compared to your program, any changes must be explained in your comments.
IMPLEMENTATION: In your program you must write several functions, including ones to write out the menu, to read in an option and (using a switch statement) to call the appropriate function, and three functions to draw the chart each of the three different ways. Note that the idea is to use three different types of loops to produce the charts. Just using cout and typing it in by hand will not be acceptable. You should also have a working exit option on your menu.
WHAT TO HAND IN: You may document your design as comments at the top of your program. You must hand in your program and sample test runs on paper. All three loops should be tested.