Thread: Stuck on tutorial number 5 (basics): switch cases

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    13
    Quote Originally Posted by Sipher View Post
    Then:
    Code:
    } while (input >= 1 && input <= 4);
    That makes it so I do the loop when I input a correct value. My aim is for the program to shut down if it's correct, but ask again if an incorrect value is given, until a correct value is entered.

    I tried
    Code:
    } while (input < 1 && input > 4);
    but it still doesn't work properly, it shuts down whatever value I enter.

    EDIT:
    Code:
    } while (input < 1 || input > 4);
    has done the trick, thanks for everyone's help!
    Last edited by rwebb2305; 06-13-2011 at 06:03 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using Functions/Switch Cases? (in my code)
    By smogsy in forum C Programming
    Replies: 1
    Last Post: 03-02-2011, 03:04 AM
  2. Question about switch cases
    By cashmerelc in forum C Programming
    Replies: 5
    Last Post: 09-21-2007, 11:57 PM
  3. switch cases and timers
    By soranz in forum C++ Programming
    Replies: 5
    Last Post: 10-02-2005, 06:43 PM
  4. switch cases and do while
    By exoillusion in forum C Programming
    Replies: 7
    Last Post: 07-28-2003, 07:18 AM
  5. could someone please explain switch cases?
    By .exe in forum C++ Programming
    Replies: 7
    Last Post: 07-01-2003, 01:42 PM

Tags for this Thread