Answer to Question #24668 in C++ for alfred lontoc

Question #24668
5. Due to poor results of your prelim examination, your teacher decides to increase each student’s grade by 5. Get all the grades and compute for the new grade. If the original grade exceeds 90, the grade remains as such. (grade.cpp)

Requirements:
Function for the input.
Function for the formula/process together with the output.

Sample Run:
Name: Eugerico
Grade: 80
Your new grade is 85
Do you want to enter another record [y/n]? y

Name: Laurence
Grade: 91
Your grade is still 91.
Do you want to enter another record [y/n]? y

Name: Ana
Grade: 76
Your new grade is 81

Do you want to enter another record [y/n]? n
Exit
1
Expert's answer
2013-02-20T08:47:03-0500
# include <iostream>
# include <string >

using namespace std;

int main(){

string name;
int d=0;
char ans;
while (true){
cout<<"Name:";
cin.ignore();
getline(cin,name,'\n');
cout<<"Grade:";
cin>>d;
cout<<"Your new grade:";
if (d<90) cout<<d+5<<endl;
if (90<=d<100) cout<<d<<endl;
cout<<"Continue?";
cin>> ans;
if (ans=='n') break;
}


system("PAUSE");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS