here is a section of code i have:
scanf( "%d", &choice1 ) ;
if ( choice1 < 1 || choice1 > 2 )
{
printf( "\n" );
printf( "ERROR: Please select either option 1 or option 2\n" );
printf( "\n" );
}
basically there are 2 options, scanf asks for a choice (either option 1 or 2). If the input value is not a 1 or a 2 it prints the error message but i then want it to go back to the scanf part so the user can have another go at inputting either option 1 or 2. Ive been told i need to use a while loop? any help much appreciated...
thanks
2007-02-21
08:08:41
·
4 answers
·
asked by
Johnno
2
in
Computers & Internet
➔ Programming & Design