|
From: Daniel G. <sp...@ho...> - 2002-11-26 10:40:37
|
use a switch statement
// This is rough
switch (value)
{
case '1':
// do stuff
// etc.
default:
cout << "wrong number!" << endl;
}
>From: Olu...@ao...
>To: dev...@li...
>Subject: [Dev-C++] Function Syntax C++
>Date: Tue, 26 Nov 2002 04:53:17 EST
>
>I want to write a function that will validate my C++ prgram. I want the
>function to display a message if wrong value type is entered. For example
>-
>
>int number1;
>cout << " Enter your number. The number must be between 1 and 4: " ;
>cin >> number1;
>
>if the user enter, a char value instead of a int value, i want the function
>to display a message of violation of variable type.
>
>Is it possible to write this type of function and what is the syntax.
>
>thnaks
>olu...@ao...
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
|