loop question

This is a discussion on loop question within the C Programming forums, part of the General Programming Boards category; This simple loop I made is supposed to print two columns down the screen, and then it stops. When I ...

  1. #1
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463

    loop question

    This simple loop I made is supposed to print two columns down the screen, and then it stops. When I run it by itself in this test program, the loop never exits. It looks fine to me, I'm lost.

    [
    Code:
    ]
    main()
    {
      int yval=8;
      clrscr();
       while(yval<21)
         {
         gotoxy(30,yval);
         printf("|");
         gotoxy(50,yval);
         printf("|");
         yval=+2;
       }
    }
    [
    ]

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    > main()
    int main()

    > yval=+2;
    This should be
    Code:
    yval +=2
    Add a return statement at the end of function main.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. For loop question
    By JuzMe in forum C++ Programming
    Replies: 11
    Last Post: 04-20-2009, 08:39 AM
  2. Loop question
    By kwood965 in forum C Programming
    Replies: 6
    Last Post: 10-29-2008, 11:12 PM
  3. simple for loop function question
    By felicityxiv in forum C Programming
    Replies: 7
    Last Post: 05-06-2006, 11:43 PM
  4. Please don't laugh...SIMPLE loop question!
    By the_lumin8or in forum C++ Programming
    Replies: 5
    Last Post: 03-31-2006, 12:08 PM
  5. while loop question
    By rayrayj52 in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2004, 05:13 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21