Results 1 to 3 of 3

Thread: I'm clueless to whats happening

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Okay...this program is [i]supposed[/] to bounce an asterisk (*) around in a console. It only moves back and forth and leaves a trail. But the console comes up blank...but little lines move accross the bottom???

    PHP Code:
    #include <iostream.h>
    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
        
    cout<<"Welcome to dot mover!"<<endl<<"press '4' and '6' to move"<<endl;
        
    int i;
        
    int theChar;
        
    int position=5;
        
    int direction 2//1 = right  2 = left
        
    while(theChar!=0)
        {
            if(
    direction==2)
            {
                for(
    i=i;i<position;i++)
                {
                    
    cout<<" ";
                    if(
    position==80)
                    {
                        
    direction=1;
                    }
                }
                    
    cout<<"*"<<endl;
            }
                    
    getchar(theChar);
            if(
    direction=1)
            {
                for(
    i=i;position<1;i--)
                {
                    
    cout<<" ";
                    if(
    position==80)
                    {
                        
    direction=2;
                    }
                    
    cout<<"*"<<endl;
                }
            }
        }
        return 
    0;

    Last edited by SteveCRM; Feb 1st, 2001 at 07:17 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width