1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to * move????

Discussion in 'C' started by shah18, Oct 3, 2010.

  1. shah18

    shah18 New Member

    Joined:
    Oct 3, 2010
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    how to * move????


     

    Attached Files:

  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
    shabbir likes this.
  3. shah18

    shah18 New Member

    Joined:
    Oct 3, 2010
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    i m trying to do but i cant do plz give a code of this program urgent
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    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);
    }
    
     

Share This Page