Thread: C++ Programming

  1. #1

    C++ Programming

    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
    Registered User
    Join Date
    Dec 2001
    when you use CIN the program will wait for a value to be entered.

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    When obtaining input from the user it is often best to get the input as a string and then parse it. If you need numerical input then have a look at atoi() which will transform a string to a number.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :-

Popular pages Recent additions subscribe to a feed