I can get everything to run perfectly, it is just when I print out the final grade, it will just give me a blank for it. Maybe I'm doing something wrong in my finalgrade function, but i don't know....I need help!
#include <iostream>
#include <iomanip>
using namespace std;
const int numtest = 3; // number of tests
const int numlab = 3; // number of labs
const int numproject = 3; // number of projects
const int numfinalexam = 1; // number of projects
void testgrades(int testscores[]);
void labgrades(int labscores[]);
void projectgrades(int projectscores[]);
void finalexamgrades (int finalexamscores[]);
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[]);
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade);
int main ()
{
cout<<fixed<<showpoint;
cout.precision(2);
int testscores[numtest];
int labscores[numlab];
int projectscores[numproject];
int finalexamscores[numfinalexam];
char finalgradescore;
testgrades(testscores);
labgrades(labscores);
projectgrades(projectscores);
finalexamgrades(finalexamscores);
finalgradescore = finalgrade(testscores,labscores,projectscores,finalexamscores);
printresults(testscores,labscores,projectscores,finalexamscores,finalgradescore);
system ("PAUSE");
return 0;
}
void testgrades (int testscores[])
{
cout<<"Test grades ";
for (int i=1; i<=numtest; i++)
{
cin>>testscores[i];
}
}
void labgrades (int labscores[])
{
cout<<"Lab grades ";
for (int i=1; i<=numlab; i++)
{
cin>>labscores[i];
}
}
void projectgrades (int projectscores[])
{
cout<<"Project grades ";
for (int i=1; i<=numproject; i++)
{
cin>>projectscores[i];
}
}
void finalexamgrades (int finalexamscores[])
{
cout<<"Final exam grade ";
for (int i=1; i<=numfinalexam; i++)
{
cin>>finalexamscores[i];
}
}
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
{
double totalpoints;
for (int i =0;i<3;i++)
{
totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);
if (totalpoints >= 90 && totalpoints <=100)
return 'A';
else if (totalpoints >= 80 && totalpoints < 90)
return 'B';
else if (totalpoints >= 70 && totalpoints < 80)
return 'C';
else if (totalpoints >= 60 && totalpoints < 70)
return 'D';
else if (totalpoints < 60 && totalpoints >= 0)
return 'E';
}
}
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade)
{
cout<<""<<endl;
int totalscores;
cout<<"Test grades"<<endl;
for (int i=1; i<=numtest; i++)
{
cout<<testscores[i]<<endl; // prints out all scores for Tests
}
cout<<""<<endl;
cout<<"Lab grades"<<endl;
for (int i=1; i<=numlab;i++)
{
cout<<labscores[i]<<endl; // prints out all scores for Labs
}
cout<<""<<endl;
cout<<"Project grades"<<endl;
for (int i=1; i<=numproject; i++)
{
cout<<projectscores[i]<<endl; // prints out all scores for Projects
}
cout<<""<<endl;
cout<<"Final Exam grade"<<endl;
for (int i=1; i<=numfinalexam;i++)
{
cout<<finalexamscores[i]<<endl; // prints out all scores for Final
}
cout<<""<<endl;
cout<<"Final grade"<<endl;
for (int i=1;i<3;i++)
{
cout<<finalgrade<<endl;
}
}