#include<iostream>;
#include<string>;
using std::cin;
using std::cout;
using std::string;
using std::endl;
int main()
{
//Grade Point Average
double grade1 = 0.0;
double grade2 = 0.0;
double grade3 = 0.0;
double grade4 = 0.0;
double grade5 = 0.0;
double grade6 = 0.0;
double grade7 = 0.0;
double grade8 = 0.0;
double grade9 = 0.0;
double grade10 = 0.0;
double gpa = 0.0;
bool numOfGrades = true;
cout << "How many grades do you have?: ";
cin >> numOfGrades;
if (numOfGrades = 1);
{
cout << "Dont even ask, its the same number you would type in.";
return 0;
}
elseif (numOfGrades = 2);
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
gpa = (grade1 + grade2) / 2;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 3);
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
gpa = (grade1 + grade2 + grade3) / 3;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 4);
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
gpa = (grade1 + grade2 + grade3 + grade4) / 4;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 5);
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5) / 5;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 6);
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6) / 6;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 7)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
cout << "What is your seventh period grade? type in percentage: ";
cin >> grade7;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7) / 7;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 8);
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
cout << "What is your seventh period grade? type in percentage: ";
cin >> grade7;
cout << "What is your eighth period grade? type in percentage: ";
cin >> grade8;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7 + grade8) / 8;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 9);
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
cout << "What is your seventh period grade? type in percentage: ";
cin >> grade7;
cout << "What is your eighth period grade? type in percentage: ";
cin >> grade8;
cout << "What is your ninth period grade? type in percentage: ";
cin >> grade9;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7 + grade8 + grade9) / 9;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 10);
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
cout << "What is your seventh period grade? type in percentage: ";
cin >> grade7;
cout << "What is your eighth period grade? type in percentage: ";
cin >> grade8;
cout << "What is your ninth period grade? type in percentage: ";
cin >> grade9;
cout << "What is your tenth period grade? type in percentage: ";
cin >> grade10;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7 + grade8 + grade9 + grade10) / 10;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
}
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::string;
using std::endl;
int main()
{
//Grade Point Average
double grade1 = 0.0;
double grade2 = 0.0;
double grade3 = 0.0;
double grade4 = 0.0;
double grade5 = 0.0;
double grade6 = 0.0;
double grade7 = 0.0;
double grade8 = 0.0;
double grade9 = 0.0;
double grade10 = 0.0;
double gpa = 0.0;
double numOfGrades = 0.0;
cout << "How many grades do you have?: ";
cin >> numOfGrades;
if (numOfGrades = 1)
{
cout << "Dont even ask, its the same number you would type in.";
return 0;
}
elseif (numOfGrades = 2)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
gpa = (grade1 + grade2) / 2;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 3)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
gpa = (grade1 + grade2 + grade3) / 3;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 4)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
gpa = (grade1 + grade2 + grade3 + grade4) / 4;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 5)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5) / 5;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 6)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6) / 6;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 7)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
cout << "What is your seventh period grade? type in percentage: ";
cin >> grade7;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7) / 7;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 8)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
cout << "What is your seventh period grade? type in percentage: ";
cin >> grade7;
cout << "What is your eighth period grade? type in percentage: ";
cin >> grade8;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7 + grade8) / 8;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 9)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
cout << "What is your seventh period grade? type in percentage: ";
cin >> grade7;
cout << "What is your eighth period grade? type in percentage: ";
cin >> grade8;
cout << "What is your ninth period grade? type in percentage: ";
cin >> grade9;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7 + grade8 + grade9) / 9;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
elseif (numOfGrades = 10)
{
cout << "What is your first period grade? type in percentage: ";
cin >> grade1;
cout << "What is your second period grade? type in percentage: ";
cin >> grade2;
cout << "What is your third period grade? type in percentage: ";
cin >> grade3;
cout << "What is your fourth period grade? type in percentage: ";
cin >> grade4;
cout << "What is your fifth period grade? type in percentage: ";
cin >> grade5;
cout << "What is your sixth period grade? type in percentage: ";
cin >> grade6;
cout << "What is your seventh period grade? type in percentage: ";
cin >> grade7;
cout << "What is your eighth period grade? type in percentage: ";
cin >> grade8;
cout << "What is your ninth period grade? type in percentage: ";
cin >> grade9;
cout << "What is your tenth period grade? type in percentage: ";
cin >> grade10;
gpa = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7 + grade8 + grade9 + grade10) / 10;
cout << "Your GPA is: " << gpa << endl;
return 0;
}
}