// // Filename: pgm2_2a.cpp // // Description: Demonstration of the if/else structure and the // conditional if operation. // // ENSC 104: Digital Computer Programming // // Instructor: Dr. Walsh // // Section: 2 // // Date Created: 01/29/98 // Last Modified: 01/29/98 // // Name: N/A // #include main() { int grade=0; cout << "Enter the student's grade: "; cin >> grade; cout << "You entered the following grade: " << grade << endl << endl; // // Example #1 // if ( grade >= 60 ) cout << "You passed the class!\n\n"; if ( grade <= 60 ) cout << "See you next semester!\n\n"; // // Example #2 // if ( grade >= 60 ) cout << "You passed the class!\n\n"; else cout << "See you next semester!\n\n"; // // Example #3 // cout << ( grade >= 60 ? "Passed" : "Failed" ) << endl; return 0; }