IfTest1

IfTest1 - cout<<"Illegal number"<< endl...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// IfTest1.cpp //-------------------------------- #include <iostream> using namespace std; /*------------------ read letter and number: A1-10 -- Group 1 A11-20 -- Group 2 A21-30 -- Group 3 B5-9 -- Group 4 B10-17 -- Group 5 b18-29 -- Group 6 else ILLEGAL GRoup ---------------------*/ - int main() { char letter; int num; cout << "Enter group letter:(A or B) "; cin >> letter; { cout << "Letter must be 'A' or 'B'" << endl; return 0; } cout << "Enter group number:(1-29) "; cin >> num; if( num <= 0 || num > 29 )
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { cout << "Illegal number" << endl; return 0; } if( letter == 'A' ) { if( num <= 10 ) cout << "Group 1" << endl; else if( num <= 20 ) cout << "Group 2" << endl; else if( num <= 30 ) cout << "Group 3" << endl; else cout << "ILLEGAL Group" << endl; } else { if( num < 5 || num > 29 ) cout << "ILLEGAL Group" << endl; else if( num <= 9 ) cout << "Group 4" << endl; else if( num <= 17 ) cout << "Group 5" << endl; else cout << "Group 6" << endl; } return 1 ; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online