|
From: Geoff B. <Geo...@Vc...> - 2003-09-23 20:38:34
|
You have to declare each side of the '||' as a seperate check.
ie:
if ((letter2 != 'u') || (letter2 != 'v') || (letter2 != 's') || (letter2 !=
't') || (letter2 != 'a')) {
cout<<"An error has occured, check you typed in only u, v, s, t or
a."<<endl;
exit();
}
I do not know for sure if the brackets inside the '||' are required but this
should fix your problem
-geoff
-----Original Message-----
From: - [mailto:ali...@nt...]
Sent: September 23, 2003 2:00 PM
To: dev...@li...
Subject: [Dev-C++] IF [faked-from][sls]
problem with if statement:
if (letter2 != 'u' || 'v' || 's' || 't' || 'a') {
cout<<"An error has occured, check you typed in only u, v, s, t or
a."<<endl;
exit();
}
Compiles ok but after checking i've realised it believes the values are part
of an earlier enum declaration:
enum value{u,v,s,t,a};
value letter;
How do i tell the compiler i want charactors, not enum values?
|