a simple loop, but i need help

i want to write a loop that i dun want the command to be X, Rd larger than 10001, Rd smaller than 0, Cd larger than 10001, or Cd smaller than 0



while ( (command != 'X') || (Rd !> 10001) || (Rd !< 0) || (Cd !> 10001) || (Cd !< 0)
{
...
}


what's wrong with my statement?
You are missing a closing bracket ( ')' ) at the end of the condition thing for your while statement and "..." is never declared. You might also want to use && as opposed to ||. I don't know, just try one, if that doesn't work, use the other, but I'm pretty sure that you will need && ("while command doesn't equal 'X' AND Rd doesn't greater than 10001"). I don't think that !< (not less than) and !> (not greater than) are valid, just use < (less than, or not greater than) or > (greater than, or not less than).

Please use [code][/code] tags.
I am answering this assuming that you mean the loop will stop when EITHER one of these conditions evaluates to TRUE:
1) command is equal to 'X'
2) Rd is larger than 10001
3) Rd is smaller than 0
4) Cd is larger than 10001
5)Cd is smaller than 0

Like I said, if your goal is to exit the loop when either one of the above statements is true then the correct form of the while statement should be:
1
2
3
4
while ( (command != 'X') && (Rd <= 10001)  && (Rd >= 0) && (Cd <= 10001) && (Cd >=0) )  
{
   /* statements */
}
Topic archived. No new replies allowed.