Monday, May 24, 2010

Need help starting my C++ code?

hello guys can someone make me a code, or just a start up for my code, her are the directions and some intro about my project code in C++. im tottally dont know how to make the two-dimensional array. if someone will guide me i appreacite it. HERE IT IS...


Thanks to the cool cell phones available today, most of us have typed a text message on our cell phones.


As you know, the numeric buttons on a phone also have letters associated with them. For example the number 3 has the letters DEF, the number 8 has TUV.


The method for entering the text is usually to press the numeric button a number of time to select the letter you want in the message. For example, since the number 5 has J-K-L on it, I would press 5 two times to select the second letter, 'K', if I wanted the letter 'C' I would press'2' three times to select the third letter.


Write a program to translate from a numeric entry to a text entry AND translate a text entry to a numeric one.


If the user enters:


3,1


2,1


8,3


4,3


3,1


/our program should print out "DAVID"


If the user enters "WAITT"


The program should print out 9,1 2,1 4,3 8,1 8,1


The maximum size of the TEXT message should be


around 50 chars


The TEXT should entered and printed out ON ONE LINE


The NUMERIC entry can be either as above or on one


line


Use 0 (zero) for space


Don't worry about using both small and capitol letters,


use only capitols OR small letters.


Do not even think about trying to write this without using


functions.


The NUMERIC output can be whatever you want, one


line or multiple lines, comma separated or dash or


whatever.


HINTS:


In the beginning, have the user select if they want to do 'NUMERIC TO TEXT" or TEXT TO NUMERIC" conversion, and then simply call the appropriate function(s)


Declare and initialize a 2 dimensional array with the phone keypad information.


For NUMERIC TO TEXT, use the user entry as the index into the array.


For TEXT TO NUMERIC conversion, scan the array with nested For loops until you find the correct letter, when you do, note what the array indexes are.


You may decide to NOT use the column array index ZERO, in which case leave the zero col filled with spaces or something. But if you choose to use indexes 1,2,3,%26amp; 4, remember you still have to take zero into account. The array index cannot start at 1

Need help starting my C++ code?
You say while (menuChoice != 3) but it has not been set to anything. You could say while(true) or while(1) and just return in your if(menuChoice == 3) block.





You need to parse the input into individual characters for the text convert and individual numbers for the num convert. You can do this by just using a char pointer, inspecting the character





At least in C++, you could declare your 2D array as char foobar[10][4] (assuming 10 numbers, 4 letters max on each).


No comments:

Post a Comment