SteveCRM
Feb 1st, 2001, 06:06 PM
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??? :confused:
#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;
}
#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;
}