Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   how to * move???? (http://www.go4expert.com/forums/how-to-move-t23475/)

shah18 3Oct2010 17:58

how to * move????
 
1 Attachment(s)
how to * move????



xpi0t0s 4Oct2010 12:18

Re: how to * move????
 
Display a * at 0,0 and maybe delay a bit for the animation to be visible.
Then display a * at 1,0 and a space at 0,0, or the other way round.
Repeat for every point along the path.

If coding the whole thing is too difficult at this stage, as a first step just run the animation from 0,0 to 10,0. Then extend it to complete the top line, then add the next section of the path and so on until complete. Then put the whole lot within an infinite loop, cos it looks like the asterisk is supposed to keep moving.

Sorry I don't know the function calls for this. But maybe you already know them? Are you on a course, and has your tutor already given you some information on how to display specific characters at specific screen locations? (gotoxy perhaps?) This is not possible with the "standard" display functions printf/cout.

shah18 4Oct2010 20:42

Re: how to * move????
 
i m trying to do but i cant do plz give a code of this program urgent

xpi0t0s 4Oct2010 21:38

Re: how to * move????
 
I'll give you the first step but it's only partial. You need to work at this, not just post "plz urgent" to forums.
Code:

for (int i=0; i<10; i++)
{
  displayAt('*',i,0); // parameters are char to display, x, y. You will need to write this function (maybe it uses gotoxy()?).
  delay(1000); // some delay function.  Assuming milliseconds, so this will display the * for 1 sec before continuing
  displayAt(' ',i,0);
}



All times are GMT +5.5. The time now is 08:36.