This is my GPA Calculator, for a homework assignment. Please share what you would have added or remove from the code. Arrays is a requirement in this code.
# include <iostream>
using namespace std;
int main ()
{
float b [100], c [100], a, a1, average_GPA, total_credits, Cummalative_GPA;
cout <<"Enter The # of Courses: ";
cin>>a;
cout <<"-------------------------------------------- \n";
a1=0; total_credits=0;
for (int i=1; i<=a;i++)
{
cout <<"Enter the credit hours for course "<< i <<": " ;
cin >> b[i];
cout<<"Enter the grade you earned for the course \n";
cout<<"(A= 4, B= 3, C= 2, D= 1) :";
cin>>c[i];
cout <<"-------------------------------------------- \n";
average_GPA = b[i] * c[i]; a1 = average_GPA + a1;total_credits = b[i] + total_credits;
}
Cummalative_GPA = a1 / total_credits;
cout<< "Your cummalative GPA for the semester is a \n" <<" (" << Cummalative_GPA <<")\n";
return (0);
}