|
-
Sep 24th, 2002, 12:52 PM
#1
Thread Starter
New Member
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.
Last edited by K.A.J; Sep 24th, 2002 at 01:06 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|