V22.0002 - ASSIGNMENT 4
Due on Thursday, November 8th 2001 at 9:30AM

Write a program that maps a capital letter to a grid display that's 2 rows by 13 columns.  The program must continuously ask for a capital letter until the user enters CTRL-Z (holds down the control key and Z key at the same time) to quit.  If the program receives a valid capital letter, it is to draw 2 rows of 13 columns, as well as header row (described below), and place the letter in the appropriate spot in the grid, and " __" in the other grid locations.  If an invalid character is entered (for example, a lower case letter or number, etc.), you are to inform the user that the character is not a valid letter (you must show the user the invalid character entered) and not draw the grid.

The mapping for the capital letter is as follows.  Since we have 26 letters in our alphabet and we have 2 rows of 13 columns, letters will go from A through M on the first row, and N through Z on the second row.  If the user enters "M", since M is the 13th character it will go on row 1, column 13.  If the user enters "N", since N is the 14th character it will go on row 2, column 1.  "Z" will go in row 2, column 13 since it is the 26th character.  Check the sample run for some examples.

Notes and Hints:

1) You must use a sentinel controlled while (or do while) loop in your program to control when to quit or continue; the value to test for in your condition is EOF
2) You must use getchar() to gather the character from the user.  Just after you get the character from the user, you must use the following line of code to clean up the input buffer so it's ready for the next character:

fflush ( stdin );
 

3) You must use field width and precision for integers to get the leading zeroes on the header row (see sample run) and field width to properly align the character in the grid.  Use a space and two underscores to represent a grid location without a letter.
4) The starting ASCII code value for 'A' is 65, and the values from continuously from there to 'Z' which is 90.  To make the problem easier, you should find a simple calculation that makes that range of 65 to 90 into 1 to 26.
5) You are NOT to write an if/else if clause for each specific letter!  Once you determine you have a valid capital letter, you are to calculate the row number and column number using the int value for the character.

SAMPLE OUTPUT

SAMPLE RUN # 1 (Blue text is displayed by the computer,and the red represents the user's input):

Please enter a capital letter to map, CTRL-Z to quit: A
 01 02 03 04 05 06 07 08 09 10 11 12 13
  A -- -- -- -- -- -- -- -- -- -- -- --
 -- -- -- -- -- -- -- -- -- -- -- -- --

Please enter a capital letter to map, CTRL-Z to quit: Z
 01 02 03 04 05 06 07 08 09 10 11 12 13
 -- -- -- -- -- -- -- -- -- -- -- -- --
 -- -- -- -- -- -- -- -- -- -- -- --  Z

Please enter a capital letter to map, CTRL-Z to quit: M
 01 02 03 04 05 06 07 08 09 10 11 12 13
 -- -- -- -- -- -- -- -- -- -- -- --  M
 -- -- -- -- -- -- -- -- -- -- -- -- --

Please enter a capital letter to map, CTRL-Z to quit: N
 01 02 03 04 05 06 07 08 09 10 11 12 13
 -- -- -- -- -- -- -- -- -- -- -- -- --
  N -- -- -- -- -- -- -- -- -- -- -- --

Please enter a capital letter to map, CTRL-Z to quit: a
a is not a valid capital letter.

Please enter a capital letter to map, CTRL-Z to quit: B
 01 02 03 04 05 06 07 08 09 10 11 12 13
 --  B -- -- -- -- -- -- -- -- -- -- --
 -- -- -- -- -- -- -- -- -- -- -- -- --

Please enter a capital letter to map, CTRL-Z to quit: ^Z
Press any key to continue