Thread: need help on writting a general outline

  1. #1
    Unregistered
    Guest

    need help on writting a general outline

    ok all i need is the general outline of the way which you think would be beast to get text to scroll...

    eg: "C++ is cool "
    "++ is cool C"
    "+ is cool C+"

    this is what i ahve up to date... i really need someone to help me work out the way to do it on paper :| also i cant use gotoxy() since it isnt standrard anymore :|

    Code:
    #include <iostream.h>
    #include <string.h>
    
    //------------------------------------------------------------------------------------------------
    void ScrollText(char text[])
    {
    	int stringlength=0;
    	int count=0;
    
    	stringlength=strlen(text);
    	
    	while(count!=stringlength) //display inital sentence no scroll yet!
    	{
    		cout<<text[count];
    		count++;
    	}
    	
    	while(secondcount!=stringlength)
    	{
    		
    		cout<<text[count]
    		
    }
    //------------------------------------------------------------------------------------------------
    void GetArray()
    /*	get a charecter array
    	Pre: none
    	Post: return a charecter array to main for use by scrolltext() */
    {
    	char text[10000];
    
    	cout<<"Enter the string to scroll now:";
    	cin.getline (text, 10000);
    	ScrollText(text);
    }
    //------------------------------------------------------------------------------------------------
    int main()
    {
    	GetArray();
    	return (0);
    }

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    559

    Re: need help on writting a general outline

    [
    Code:
    #include <iostream.h>
    #include <string.h>
    
    //------------------------------------------------------------------------------------------------
    void ScrollText(char text[])
    {
    		
    	while(secondcount!=stringlength)
    Here's a problem. You never declare secondcount. Haven't checked the logic in the program, but this'll stop you first.

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    PHP Code:
    #include <conio.h>
    #include <iostream>

    using namespace std;

    #define MAX_SCROLLTEXT 100

    //
    // general way to do it:
    //
    // get the text ("Test")
    // copy it two times ("TestTest")
    // REPEAT
    //    print the textlength ( Test = 4 ) characters of the two texts
    //    add one to start
    //    if start > textlength, set start back to zero
    // UNTIL keypress
    // 

    // note: gotoxy, _kbhit and a delay function are operating system specific.

    int main()
    {
        
    char szScrollTextMAX_SCROLLTEXT ];
        
    char szScrollingMAX_SCROLLTEXT ];
        
    int  nTextLength;
        
    int  i 0;

        
    cout << "Enter Text to scroll:";
        
    cin.getlineszScrollTextMAX_SCROLLTEXT );
        
        
    strcpyszScrollingszScrollText ); 
        
    strcatszScrollingszScrollText );

        
    nTextLength strlenszScrollText );

        
    memsetszScrollText0MAX_SCROLLTEXT );

        while( ! 
    _kbhit() )
        {
            
    strncpyszScrollTextszScrolling inTextLength );
        
            
    cout << szScrollText << endl;
            
            
    i++;
            
            if( 
    >= nTextLength 0;

            
    // place gotoxy here
            // place delay here
        
    }
        
        return 
    0;

    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. The Tone of General Discussions
    By sean in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-03-2009, 09:06 PM
  2. General Guidelines on Preventing Header File collision
    By stanlvw in forum C++ Programming
    Replies: 12
    Last Post: 07-05-2008, 04:02 AM
  3. Password program / general programming questions
    By plr112387 in forum C++ Programming
    Replies: 13
    Last Post: 11-04-2007, 10:10 PM
  4. Splitting BST General
    By cpp_is_fun in forum C++ Programming
    Replies: 1
    Last Post: 11-25-2005, 02:02 AM
  5. A general protection exception failure
    By louis_mine in forum C Programming
    Replies: 7
    Last Post: 11-25-2004, 02:22 AM