/* calcpay1.cpp 6/5/08 David Klick Demonstration of if/else from class. */ #include using std::cin; using std::cout; void cont(); int main() { double hours = 0.0; double rate = 0.0; double gross = 0.0; cout << "Enter the employee's hourly rate: "; cin >> rate; cout << "Enter the hours the employee worked: "; cin >> hours; if (hours > 40.0) { gross = 40.0 * rate + (hours - 40.0) * 1.5 * rate; } else { gross = hours * rate; } cout << "The gross pay is " << gross << "\n\n"; cont(); return 0; } void cont() { if (cin.rdbuf()->sungetc() != -1 && cin.get() != '\n') cin.ignore(80,'\n'); cout << "Press enter to continue..."; cin.get(); }