I am trying to make a grade book and using a vector to get the grades. I am getting errors all over and I figured this would happen because this is the first time I ever used vectors.
Code:
#ifndef ___2B__Homework__LetterGrade__
#define ___2B__Homework__LetterGrade__
#include <iostream>
#include <vector>
using namespace std;
class GradeBook {
public:
void getGrades()
{
int numGrades=0;
int checker;
cout<< " Enter the students Grades and Enter -1 to stop. "<<endl;
while (checker != -1) {
cin>>checker;
++numGrades;
vector<int> grades(numGrades);
for (int i =0; i<numGrades; ++i) {
cin>>grades[i];
averageGrades(grades[i],numGrades);
}
}
}
double averageGrades(int grades[],int num)
{
double total;
double average;
for (int i=0; i<num; ++i) {
total += grades[i];
}
average = total / num;
return average;
}
void letterGrade()
{
}
private:
};
#endif