Bounce a character around the screen using for loops & gotoxy
Greets all,
I'm following some examples of using the gotoxy function from a c book that i am reading, and can't seem to get the quiz/task. Here's how it goes, i am trying to get the character O to bounce around the screen, using a few four loops and the goto function. I am able to get the character to go diagonally accross the screen with...
Code:
void main(void)
{ int x,y,z;
for(x=0,y=0,z=0;z<5000;x++,y++,z++)
{
gotoxy(x,y);
printf("O");
delay(100);
clrscr();
}
getch();
}
But i want the character 'ball' to bounce around the screen. I asked my programming teacher to give me tips, but i asked him not to give me the answe completely else i won't learn anything. He said that i needed, 4 if statements, which i have tried adding into the code, but to no avail. I have now given up, and would like to find out the answer as i'm ripping my hair out.