/* testio3.cpp CIS 150 5/31/2005 David Klick This program demonstrates data validation using the switch selection structure. */ #include using std::cout; using std::cin; int main(void) { char ch; bool error = false; cout << "Enter the letter 'Y': "; cin >> ch; switch (ch) { case 'y': case 'Y': cout << "Thank you\n"; break; default: cout << "Invalid character entered\n"; error = true; } if (error) { cout << "Abnormal program termination\n"; } else { cout << "Normal program end\n"; } return 0; }