# HELP! 1st Project!

• 09-15-2008
Zionstorm
HELP! 1st Project!
I have been working on this 1st project for an intro level programming class, and I just can't seem to get this working. It just needs to be as basic as it can be. All help is greatly appreciated. Here are the instructions:

For this project, design and implement a Visual C++ .NET program that will simulate a simple text messaging system. The only characters that you can send are A to Z and space. A space is represented by sending a single 0. Each character that is entered is separated from the next character by a 1. Two consecutive 0 digits will end the text message. We will not need to enter a 1 after a space (0), since text messages will not have 2 consecutive spaces, except at the end of the message. For example, to send the two-character text message "CS" you would see the input stream "2 2 2 1 7 7 7 7 1 0 0". Your project should read in a sequence of integers that represent the encoding of multi-character text message, and then print out that text message. For this project, you can assume that the input will be legal. A complete message will contain several 1’s plus the appropriate number of the digits 2 through 9 and 0 to create and terminate a message.

Thats the project. Some sample i/o

The input:
4 44 1 0 5 5 5 1 4 4 4 1 5 5 1 3 3 1 0 4 4 4 1 2 2 2 1 3 3 1 0 2 2 2 1 7 7 7 1 3 3 1 2 1 6 1 0 0

would yield:
i like ice cream

Pseudo-code:
Start:
Declare & initialize variables needed
Loop until “finished”: (How do you know when you‟re finished?)
Is number a 0?
Yes: Save the number in “last number” and set the counter to zero;
Is number a 1?
Yes: (You should have read the numbers for a specific letter. Print it out.)
Print out the correct number for the “last number” entered, and the value
of the counter.
For example, if the last number is a 2 and the counter is 1, print "A.‟
Or if the last number is an 8 and the counter is a 2, print "U.‟
After you‟ve printed the letter, set the counter to 0 and the last number to 1.
Is the number a 2, 3, 4, 5, …, 9?
Yes: Save it in “last number,” increment the counter.
Otherwise (number is not in 0 – 9) print an error message, including the number.
Read another number, and then go back to the top of the loop.
End of loop (when you‟re “finished)
Quit.
• 09-15-2008
rags_to_riches
You're going to have to show some effort of your own before you get any help here.
• 09-15-2008
Zionstorm
I have been trying to use switch statements too, but I am a complete novice at all of this and I just can't seem to get it work. I have something like this at the moment.

Code:

```#include<iostream> using namespace std; int main(){         int a,input,count,x,y;                         {         count=0;         do                 cin >> input;         while(input!=1);//for individual character                 {                 a=input;                 if(input==0)                                         count++;                 }                 a=count;                 x++;         } }```
• 09-15-2008
laserlight
Zionstorm, I suggest that you indent your code more consistently, e.g.:
Code:

```#include<iostream> using namespace std; int main() {     int a, input, count, x, y;     {         count = 0;         do             cin >> input;         while (input != 1); //for individual character         {             a = input;             if (input == 0)                 count++;         }         a = count;         x++;     } }```