saiz66 Posted June 28, 2004 Share Posted June 28, 2004 I wanna check if a character (college) is either T, C, E, O , G or J. return 1 else return 0 if(toupper(college) ==('T' || 'E' || 'O' || 'G' || 'J')) it doesn't work though.. any help? Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted June 28, 2004 Share Posted June 28, 2004 You should probably switch off of those, otherwise, you'll have a sloppy if statement. switch( toupper(college) ) { case 'T': case 'E': case 'O': case 'G': case 'J': return 1; default: return 0; } To do compound if statements you'd need to do this: if( toupper(college) == 'T' || toupper(college) == 'E' || toupper(college) == 'O' || toupper(college) == 'G' || toupper(college) == 'J' ) return 1; else return 0; Link to comment Share on other sites More sharing options...
0 saiz66 Posted June 28, 2004 Author Share Posted June 28, 2004 Thanks alot! Link to comment Share on other sites More sharing options...
Question
saiz66
I wanna check if a character (college) is either T, C, E, O , G or J. return 1 else return 0
if(toupper(college) ==('T' || 'E' || 'O' || 'G' || 'J'))it doesn't work though.. any help?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts