Erase what you just printed in a while loop
Code:
#include <iostream>
#include <conio.h>
int main()
{
int x = 0; //Horizontil coordinates
int y = 0; //Vertical coordinates
int whereToGo;
while (whereToGo != 27)
{
for (int i = 0; i < y; i++)
{
cout << "\n";
}
for (int i = 0; i < x; i++)
{
cout << " ";
}
cout << "*";
whereToGo = getch();
if(whereToGo == 80)//if press down arrow then make y = 1 + y
{
y++;
}
if(whereToGo == 72)//if press up arrow then make y = y - 1
{
y--;
}
if(whereToGo == 77)//if press right arrow then make x = 1 + x
{
x++;
}
if(whereToGo == 75)//if press left arrow then make x = x - 1
{
x--;
}
}
return 0;
}
I am making a simple program that makes it look like the little * is moving. but after whereToGo = getch() i need it to erase what it print before that... do you understand what i mean?... please help
Can you post the last ver.,
Please could you post the last version of your work, and can you tell how many problems you still have ?