# GWA Alpha

Fri Jan 06 2023 13:07:55 GMT+0000 (Coordinated Universal Time)

Saved by @Kyle #c++

```#include <iostream>
#include <string.h>
using namespace std;

int main() {

double gr1, gr2, gr3, gr4, gr5, gr6, gr7, gr8, gr9, gr10, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, aggregate_grade, gwa;
int un1, un2, un3, un4, un5, un6, un7, un8, un9, un10, numsub, total_units;
string sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8, sub9, sub10;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

cout << "------------------------\n"
<< "IT 202D FINAL OUTPUT\n"
<< "GWA CALCULATOR\n"
<< "------------------------\n"
<< "Please enter the number of subjects that " << endl
<< "you took this semester (excluding NSTP and subjects \n"
<< "with non-numeric ratings): ";
cin >> numsub;

if (numsub == 2)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

aggregate_grade = p1 + p2;
total_units = un1 + un2;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else if (numsub == 3)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub3;
cout << "Number of Credited Units: ";
cin >> un3;
cout << "Grade: ";
cin >> gr3;
p3 = un3 * gr3;

aggregate_grade = p1 + p2 + p3;
total_units = un1 + un2 + un3;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else if (numsub == 4)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub3;
cout << "Number of Credited Units: ";
cin >> un3;
cout << "Grade: ";
cin >> gr3;
p3 = un3 * gr3;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub4;
cout << "Number of Credited Units: ";
cin >> un4;
cout << "Grade: ";
cin >> gr4;
p4 = un4 * gr4;

aggregate_grade = p1 + p2 + p3 + p4;
total_units = un1 + un2 + un3 + un4;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else if (numsub == 5)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub3;
cout << "Number of Credited Units: ";
cin >> un3;
cout << "Grade: ";
cin >> gr3;
p3 = un3 * gr3;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub4;
cout << "Number of Credited Units: ";
cin >> un4;
cout << "Grade: ";
cin >> gr4;
p4 = un4 * gr4;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub5;
cout << "Number of Credited Units: ";
cin >> un5;
cout << "Grade: ";
cin >> gr5;
p5 = un5 * gr5;

aggregate_grade = p1 + p2 + p3 + p4 + p5;
total_units = un1 + un2 + un3 + un4 + un5;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else if (numsub == 6)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub3;
cout << "Number of Credited Units: ";
cin >> un3;
cout << "Grade: ";
cin >> gr3;
p3 = un3 * gr3;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub4;
cout << "Number of Credited Units: ";
cin >> un4;
cout << "Grade: ";
cin >> gr4;
p4 = un4 * gr4;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub5;
cout << "Number of Credited Units: ";
cin >> un5;
cout << "Grade: ";
cin >> gr5;
p5 = un5 * gr5;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub6;
cout << "Number of Credited Units: ";
cin >> un6;
cout << "Grade: ";
cin >> gr6;
p6 = un6 * gr6;

aggregate_grade = p1 + p2 + p3 + p4 + p5 + p6;
total_units = un1 + un2 + un3 + un4 + un5 + un6;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else if (numsub == 7)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub3;
cout << "Number of Credited Units: ";
cin >> un3;
cout << "Grade: ";
cin >> gr3;
p3 = un3 * gr3;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub4;
cout << "Number of Credited Units: ";
cin >> un4;
cout << "Grade: ";
cin >> gr4;
p4 = un4 * gr4;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub5;
cout << "Number of Credited Units: ";
cin >> un5;
cout << "Grade: ";
cin >> gr5;
p5 = un5 * gr5;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub6;
cout << "Number of Credited Units: ";
cin >> un6;
cout << "Grade: ";
cin >> gr6;
p6 = un6 * gr6;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub7;
cout << "Number of Credited Units: ";
cin >> un7;
cout << "Grade: ";
cin >> gr7;
p7 = un7 * gr7;

aggregate_grade = p1 + p2 + p3 + p4 + p5 + p6 + p7;
total_units = un1 + un2 + un3 + un4 + un5 + un6 + un7;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else if (numsub == 8)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub3;
cout << "Number of Credited Units: ";
cin >> un3;
cout << "Grade: ";
cin >> gr3;
p3 = un3 * gr3;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub4;
cout << "Number of Credited Units: ";
cin >> un4;
cout << "Grade: ";
cin >> gr4;
p4 = un4 * gr4;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub5;
cout << "Number of Credited Units: ";
cin >> un5;
cout << "Grade: ";
cin >> gr5;
p5 = un5 * gr5;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub6;
cout << "Number of Credited Units: ";
cin >> un6;
cout << "Grade: ";
cin >> gr6;
p6 = un6 * gr6;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub7;
cout << "Number of Credited Units: ";
cin >> un7;
cout << "Grade: ";
cin >> gr7;
p7 = un7 * gr7;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub8;
cout << "Number of Credited Units: ";
cin >> un8;
cout << "Grade: ";
cin >> gr8;
p8 = un8 * gr8;

aggregate_grade = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8;
total_units = un1 + un2 + un3 + un4 + un5 + un6 + un7 + un8;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else if (numsub == 9)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub3;
cout << "Number of Credited Units: ";
cin >> un3;
cout << "Grade: ";
cin >> gr3;
p3 = un3 * gr3;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub4;
cout << "Number of Credited Units: ";
cin >> un4;
cout << "Grade: ";
cin >> gr4;
p4 = un4 * gr4;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub5;
cout << "Number of Credited Units: ";
cin >> un5;
cout << "Grade: ";
cin >> gr5;
p5 = un5 * gr5;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub6;
cout << "Number of Credited Units: ";
cin >> un6;
cout << "Grade: ";
cin >> gr6;
p6 = un6 * gr6;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub7;
cout << "Number of Credited Units: ";
cin >> un7;
cout << "Grade: ";
cin >> gr7;
p7 = un7 * gr7;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub8;
cout << "Number of Credited Units: ";
cin >> un8;
cout << "Grade: ";
cin >> gr8;
p8 = un8 * gr8;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub9;
cout << "Number of Credited Units: ";
cin >> un9;
cout << "Grade: ";
cin >> gr9;
p8 = un9 * gr9;

aggregate_grade = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9;
total_units = un1 + un2 + un3 + un4 + un5 + un6 + un7 + un8 + un9;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else if (numsub == 10)
{
cout << "------------------------\n"
<< "Subject Code: ";
cin >> sub1;
cout << "Number of Credited Units: ";
cin >> un1;
cout << "Grade: ";
cin >> gr1;
p1 = un1 * gr1;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub2;
cout << "Number of Credited Units: ";
cin >> un2;
cout << "Grade: ";
cin >> gr2;
p2 = un2 * gr2;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub3;
cout << "Number of Credited Units: ";
cin >> un3;
cout << "Grade: ";
cin >> gr3;
p3 = un3 * gr3;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub4;
cout << "Number of Credited Units: ";
cin >> un4;
cout << "Grade: ";
cin >> gr4;
p4 = un4 * gr4;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub5;
cout << "Number of Credited Units: ";
cin >> un5;
cout << "Grade: ";
cin >> gr5;
p5 = un5 * gr5;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub6;
cout << "Number of Credited Units: ";
cin >> un6;
cout << "Grade: ";
cin >> gr6;
p6 = un6 * gr6;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub7;
cout << "Number of Credited Units: ";
cin >> un7;
cout << "Grade: ";
cin >> gr7;
p7 = un7 * gr7;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub8;
cout << "Number of Credited Units: ";
cin >> un8;
cout << "Grade: ";
cin >> gr8;
p8 = un8 * gr8;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub9;
cout << "Number of Credited Units: ";
cin >> un9;
cout << "Grade: ";
cin >> gr9;
p8 = un9 * gr9;

cout << "\n------------------------\n"
<< "Subject Code: ";
cin >> sub10;
cout << "Number of Credited Units: ";
cin >> un10;
cout << "Grade: ";
cin >> gr10;
p8 = un10 * gr10;

aggregate_grade = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10;
total_units = un1 + un2 + un3 + un4 + un5 + un6 + un7 + un8 + un9 + un10;
gwa = aggregate_grade / total_units;
cout << "\n------------------------\n"
<< "GWA = " << gwa
<< "\n------------------------\n";
}

else
{
cout << "\n------------------------\n"
<< "Invalid entry";
}
return 0;
}```
content_copyCOPY