Topic: Files and Streams
Codes discussed will be posted here. Write your conclusion on the File stream discussion.
File name: "Ch4_GPA_Requirement_CorrectProrgam.cpp"
Given problem and code:
//Correct GPA program.
#include <iostream> //Line 1
using namespace std; //Line 2
int main() //Line 3
{ //Line 4
double gpa; //Line 5
cout << "Enter the GPA: "; //Line 6
cin >> gpa; //Line 7
cout << endl; //Line 8
if (gpa >= 2.0) //Line 9
{ //Line 10
if (gpa >= 3.9) //Line 11
cout << "Dean\'s Honor List." << endl; //Line 12
} //Line 13
else //Line 14
cout << "The GPA is below the graduation "
<< "requirement. \nSee your "
<< "academic advisor." << endl; //Line 15
return 0; //Line 16
}
*Note: Need the proper codes
*Note need proper codes and conclusion on how its done and about the results. And please give the proper solution and explanation. And give a conclusion on why did you say so and re-examine the given codes and place your conclusion
The program defines a variable gpa, and prompt the user to enter the gpa and print a new Line
The program then checks if the gpa is less than or equals to 2.0. If this is true, it checks if
the gpa is greater than or equal to 3.9.
Comments
Leave a comment