Question
I have to complete a C++ program that reads an input file,calculates grade(midterm 40% of grade and final is 60%). I alsohave to display the output on the screen/monitor. I have to use'setw' to align the output in 'rows and columns' the sample input file Terry 75.9225 90.25252 Lee 87.9732 81.9283 sample output Midterm Final Grade Terry 75.92 90.25 84.52 Lee 87.97 81.93 84.35 I've started it, i'm not sure if i'm on the right path ornot int main() { cout<<fixed<<showpoint; cout.precision(2); doubletMidterm= 75.9225, tFinal=90.25252,lMidterm=87.9732 lFinal=81.9283 // cout<<"First Name "<<"Midterm "<<endl; I have to complete a C++ program that reads an input file,calculates grade(midterm 40% of grade and final is 60%). I alsohave to display the output on the screen/monitor. I have to use'setw' to align the output in 'rows and columns' the sample input file Terry 75.9225 90.25252 Lee 87.9732 81.9283 sample output Midterm Final Grade Terry 75.92 90.25 84.52 Lee 87.97 81.93 84.35 I've started it, i'm not sure if i'm on the right path ornot int main() { cout<<fixed<<showpoint; cout.precision(2); doubletMidterm= 75.9225, tFinal=90.25252,lMidterm=87.9732 lFinal=81.9283 // cout<<"First Name "<<"Midterm "<<endl;
Explanation / Answer
please rate - thanks #include #include #include using namespace std; int main() {string name; double midterm, final,grade; ifstream input; input.open("input.txt"); //open file if(input.fail()) //is it ok? { cout