HELP! 1st Project!

This is a discussion on HELP! 1st Project! within the C++ Programming forums, part of the General Programming Boards category; I have been working on this 1st project for an intro level programming class, and I just can't seem to ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    5

    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
    Read the 1st number
    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.

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,664
    You're going to have to show some effort of your own before you get any help here.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    5
    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++;
    	}
    }

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,641
    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++;
        }
    }
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Displaying a Struct
    By rockstarpirate in forum C++ Programming
    Replies: 16
    Last Post: 05-05-2008, 09:05 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Dynamic Binding
    By gpr1me in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2006, 08:01 AM
  4. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21