Go Back   The UNIX and Linux Forums > Top Forums > Programming
.
google site




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 04-29-2002
giannicello giannicello is offline
Registered User
 

Join Date: Sep 2001
Location: Phoenix
Posts: 173
So you have already checked that they've entered numbers between 1 and 3?

Then what you are saying is
if (x == '1') {
do something;
}
if (x =='2' {
do s/t;
etc...

better yet...

switch (x) {
case '1':
{
do something:
}
break;
case '2':

{
do something:
}
break;
case '3':

{
do something:
}
break;
default:
printf("Please enter values between 1 and 3!");
break;
}

Let me know if this helps or if I understand.

Gianni