Input validation

This is a discussion on Input validation within the C++ Programming forums, part of the General Programming Boards category; How do I check for a blank entry for numerical input in a C++ program? For example, if my input ...

  1. #1
    Unregistered
    Guest

    Input validation

    How do I check for a blank entry for numerical input in a C++ program? For example, if my input variable is Qty (an int), how do I check to see if the user simply presses Enter without keying in a value for Qty?

  2. #2
    A Banana Yoshi's Avatar
    Join Date
    Oct 2001
    Posts
    857
    It is checked already with "cin". It will '\n' it until a valid data is inputted.
    ----------------
    Engineer223
    Yoshi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Printing Length of Input and the Limited Input
    By dnguyen1022 in forum C Programming
    Replies: 33
    Last Post: 11-29-2008, 03:13 PM
  2. Problem getting the input from a temp variable into the Array
    By hello_moto in forum C++ Programming
    Replies: 3
    Last Post: 03-16-2006, 12:50 AM
  3. Input validation loop failure
    By MacNilly in forum C++ Programming
    Replies: 4
    Last Post: 03-01-2006, 02:29 AM
  4. Input Validation Question
    By zackboll in forum C Programming
    Replies: 14
    Last Post: 10-12-2004, 12:05 AM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 12:50 PM

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