Help with 'while'

This is a discussion on Help with 'while' within the C Programming forums, part of the General Programming Boards category; hey guys, im having trouble doing while statements in C... can someone help me out. im entering a number between ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    1

    Help with 'while'

    hey guys, im having trouble doing while statements in C... can someone help me out.
    im entering a number between 1 and 10 and it is meant to change a colour. if the number is out the range then it is meant to prompt for you to enter another number. any ideas, its just not working at all

  2. #2
    ~viaxd() viaxd's Avatar
    Join Date
    Aug 2003
    Posts
    246
    Code:
    do
    {...} while(number < 1 || number > 10);
    Last edited by viaxd; 08-30-2004 at 04:17 AM.
    :wq

  3. #3
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    edit::

    useless information used to be here.
    Last edited by kermit; 08-30-2004 at 04:49 AM.

  4. #4
    ~viaxd() viaxd's Avatar
    Join Date
    Aug 2003
    Posts
    246
    nope, the loop repeats only if the number is out of range (1-10).

    [edit] lol, i made a stupid mistake, should be || not &&, fixed [/edit]
    Last edited by viaxd; 08-30-2004 at 04:18 AM.
    :wq

Popular pages Recent additions subscribe to a feed

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