Hi, I am trying to get 5 quiz scores, 3 exam scores, and 1 final exam score in this bit of code. However, when I run this and print it out, the last quiz value is 0 and then the first exam value is the last quiz value. I have no clue what is wrong with my code. Any help would be greatly appreciated :)
void get_scores()
{
cout << "Please enter your final exam score." << endl;
{
cin >> fexam;
}
cout << " Please enter your quiz scores."<<endl;
for (int i = 0; i < 4; ++i)
{
cin >> quiz[i];
}
cout << "Please enter your exam scores." << endl;
for (int i = 0; i < 2; ++i)
{
cin >> exams[i];
}
}
This is how they are declared:
int exams [3] ; //amount of exams
int quiz [5] ; //amount of quizzes
int fexam; //amount of finals exams
You have 5 quiz scores but input only 4: for (int i = 0; i < 4; ++i) { cin >> quiz[i]; }
You have 3 exam scores but input only 2: for (int i = 0; i < 2; ++i) { cin >> cin >> exams[i]; }