Thread: gotoxy breaking the FOR loop

  1. #1
    Registered User
    Join Date
    Apr 2013
    Location
    Gurgaon, Haryana, India
    Posts
    41

    Question gotoxy breaking the FOR loop

    I was just trying my hand on the gotoxy function so that i can utelise it another programs but am currently stuck with a looping issue,when i use gotoxy inside a FOR loop it in plce of completing the loop abrupts at a single output.gotoxy breaking the FOR loop-gotoerror1-jpg
    this is a sample i m tryng.
    //outputAttachment 12780what i want is a vertical line of 0's.
    Attached Images Attached Images gotoxy breaking the FOR loop-gotoerror2-jpg 
    Last edited by Amitesh93; 06-04-2013 at 06:13 AM.

  2. #2
    Registered User
    Join Date
    Apr 2013
    Location
    Gurgaon, Haryana, India
    Posts
    41
    Please guys help!!!

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Amitesh93 View Post
    Please guys help!!!
    I haven't heard about a "gotoxy.h" header file, but clearly, your loop (if the gotoxy function is working), has the wrong logic in it.

    You are printing the x at the same place, every time. (5,5).

    What you want for a vertical line would be:
    Code:
    int y;
    
    for(y=1;y<11;y++) {
       gotoxy(10,y);
       putchar('0');
    }
    Try that loop.

  4. #4
    Registered User
    Join Date
    Apr 2013
    Location
    Gurgaon, Haryana, India
    Posts
    41

    Talking

    Quote Originally Posted by Adak View Post
    I haven't heard about a "gotoxy.h" header file, but clearly, your loop (if the gotoxy function is working), has the wrong logic in it.

    You are printing the x at the same place, every time. (5,5).

    What you want for a vertical line would be:
    Code:
    int y;
    
    for(y=1;y<11;y++) {
       gotoxy(10,y);
       putchar('0');
    }
    Try that loop.
    thanks dude got my error, actually i have created a gotoxy library myself it is workng nd thanks to ur help its resolved.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Welcome to the forum, Amitesh93.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Breaking out of a loop
    By theitsmith in forum C Programming
    Replies: 3
    Last Post: 02-09-2012, 12:30 PM
  2. breaking a for loop
    By begginer in forum C Programming
    Replies: 6
    Last Post: 03-23-2011, 02:26 PM
  3. Breaking out of a loop
    By kiros88 in forum C Programming
    Replies: 5
    Last Post: 09-01-2009, 11:49 AM
  4. Breaking out of the loop
    By ICool in forum C Programming
    Replies: 5
    Last Post: 09-24-2007, 08:27 AM
  5. Breaking out of a loop
    By escarrina in forum C Programming
    Replies: 9
    Last Post: 04-05-2004, 12:05 PM