支持原创
// it's a GPA calculator,helping you to calculate your score and your GPA,Have fun
#include
#include
using namespace std;
string course;
double score=0;
double point=0;
double wholepoint=0;
double coursescore=0;
double GPA=0;
double tGPA=0;
int main()
{
while(1)
{
cout<
cout<
cout<
cout<
cout<
cout<
cout<
while(1)
{
cout<
getline(cin,course);
if(course=="0")
break;
cout<
cin>>point;
wholepoint+=point;
cout<
cin>>coursescore;
score+=coursescore*point;
if(coursescore>=90)
{
GPA=4;
tGPA+=GPA*point;
}
else
if(coursescore>=80)
{
GPA=3;
tGPA+=GPA*point;
}
else
if(coursescore>=70)
{
GPA=2;
tGPA+=GPA*point;
}
else
if(score>=60)
{
GPA=1;
tGPA+=GPA*point;
}
else
{
GPA=0;
tGPA+=GPA*point;
}
GPA=0;
point=0;
coursescore=0;
cin.get();
}
score=score/wholepoint;
tGPA=tGPA/wholepoint;
cout<
cout<
cout<
continue;
}
return 0;
}