Validating c

Rated 3.84/5 based on 685 customer reviews

The program might crash, but that is a consequence of GIGO. It accepts a single character from the user: Go ahead and copy this into your compiler; compile and run.You can enter a 7, or a 3 or even an entire string of text.Data can be entered incorrectly either by mistake or on purpose.C programmers must be vigilant to ensure both malicious and unintentional bad entry does not occur.

We need a way to ensure that the user enters a NUMERIC, single-digit value!

Therefore, if you have to enter a 25-character code, you would make the array having 26 indices.

For user validation, the program should make use of a loop so that users have an opportunity to enter the correct data.

For more information, see the WM_KILLFOCUS topic in the "Keyboard Input Reference" section, and the "Message Deadlocks" section of the "About Messages and Message Queues" topic in the MSDN library at

The following code example uses the derived class Text Box and validates an e-mail address that the user enters.

Leave a Reply