So basically this is suppose to be a grade calculator and the program works, I now just have to put it into a do-while loop so it can work for more than one student. My professor wants it to say Y for another student and N to quit at the end. I'm having a hard time figuring how to make that work. Also he wants the averages to come out to two decimal places even if its just 88.00 but it isn't working when I use setprecision. Any suggestions would be grealy appreciated.
#include <iostream>
#include <iomanip>
using namespace std;
int main (){
system ("color f0");
string firstName, lastName, fullName;
char middle;
float score1, score2, score3, score4, score5, score6, score7;
cout<<"Student Grade Calculator"<<endl;
cout<<endl;
do{
cout<<"Please enter your first name, middle intial, and last name :"<<" ";
cin>>firstName>>middle>>lastName;
fullName=firstName+" "+middle+" "+lastName;
cout<<endl;
cout<<"Thank you, your name is"<<" "<<fullName<<endl;
cout<<endl;
cout<<"Please enter the first program score (0-100): ";
cin>>score1;
cout<<endl;
cout<<"You entered"<<" "<<score1<<endl;
cout<<endl;
cout<<"Please enter the second program score (0-100): ";
cin>>score2;
cout<<endl;
cout<<"You entered"<<" "<<score2<<endl;
cout<<endl;
cout<<"Please enter the third program score (0-100): ";
cin>>score3;
cout<<endl;
cout<<"You enterd"<<" "<<score3<<endl;
cout<<endl;
cout<<"Please enter the fourth program score (0-100): ";
cin>>score4;
cout<<endl;
cout<<"You entered"<<" "<<score4<<endl;
cout<<endl;
cout<<"Please enter the first test score (0-100): ";
cin>>score5;
cout<<endl;
cout<<"You entered"<<" "<<score5<<endl;
cout<<endl;
cout<<"Please enter the second test score (0-100): ";
cin>>score6;
cout<<endl;
cout<<"You entered"<<" "<<score6<<endl;
cout<<endl;
cout<<"Please enter the third test score (0-100): ";
cin>>score7;
cout<<endl;
cout<<"You entered"<<" "<<score7<<endl;
cout<<endl;
cout<<setw(32)<<"*"<<endl;
double avr1,avr2,avr3;
char grade,Y,N;
avr1=(score1+score2+score3+score4)/4;
avr2=(score5+score6+score7)/3;
avr3=(avr1+avr2)/2;
cout<<"Name: "<<" "<<fullName<<endl;
cout<<endl;
cout<<"Program Average.........."<<" "<<avr1<<endl;
cout<<endl;
cout<<"Test Average............."<<" "<<avr2<<endl;
cout<<endl;
cout<<"Course Average..........."<<" "<<avr3<<endl;
cout<<endl;
//Nested if-statement
if(avr3>=95)
{
cout<<"Leter Grade.............. A"<<endl;
}
else if (avr3<=95 && avr3>90)
{
cout<<"Letter Grade................. A-"<<endl;
}
else if (avr3<90 && avr3>=85)
{
cout<<"Letter grade................. B"<<endl;
}
else if (avr3<=85 && avr3>80)
{
cout<<"Letter Grade................. B-"<<endl;
}
else if(avr3<80 && avr3>=70)
{
cout<<"Letter grade................. C"<<endl;
}
else
{
cout<<"Letter grade................. F"<<endl;
}
cout<<setw(32)<<"*"<<endl;
cout<<"Please enter Y for another student or N to quit: "<<endl;
cin>>Y,N;
}while(N!=0);
system ("pause");
return 0;
}//end of main