#include using namespace std; const int RESPONSE_LEN = 80; bool IsYes(char input[], int inputLen); int main() { char response[RESPONSE_LEN]; cout << "Do you like C++? Respond 'Yes' or 'No'." << endl; cin >> response; if ( IsYes(response, RESPONSE_LEN) ) cout << "Then you're in the right class!" << endl; else cout << "Maybe you'll like assembly language better." << endl; return 0; } bool IsYes(char input[], int inputLen) { int i = 0; // pass over spaces while (input[i] == ' ') ++i; switch(input[i]) { case 'y': case 'Y': return true; default: return false; } }