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