// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 1170, Spring 2008 // Lab 6: Logical expressions and if statement // Date: January 12, 2009 // Comment: The code here is meant to be revised. // //----------------------------------------------------------------- // // This lab exercise is to play with logical expressions compised of // relational and logical operators, if-statements, if-else-statements, // chained if-else-statements, nested if-statements // // The problem here is to compute the letter grade for the user when // the score is entered. The formula to do the calculation is as follows: // A if 90<=score; B is 80<=score <90; C if 70<=score<80; D if // 60 <=score <70; F if otherwise. // // Compile and run your program. When everything is fine, // print your .cpp file and turn it to me or the TA. // ***************************************************************** #include < iostream > #include #include < string > #include < cstring > #include < cmath> #include #include using namespace std; int main( ) { //variable declaration double score; //var to store score for the class //ask for score from the user cout<<"What is your score for the class? ==> "; cin>>score; /******************************************************************* Part A. Use if-statements only. I do two statements and you do the rest. ******************************************************************/ if (score >= 90) cout<< "Your grade is A." <=90) cout<< "Your grade is A." <70) { cout<< "You passed the class. And, your grade is " <= 90) cout<<" A " <