#include <iostream>
using namespace std;
int main()
{
int grade[4];
int average;
cout << "please enter four numeric grades to get the average.\n\n";
cin >> grade[0] >> endl;
cin >> grade[1] >> endl;
cin >> grade[2] >> endl;
cin >> grade[3] >> endl;
average = (grade [0] + grade[1] + grade[2] + grade[3]) / 4;
cout << average << " is your average grade.";
return 0;
}
For some reason I don't get any compiler errors but when I run the program I get the error "Bus error (core dumped)" after I enter the second number into the program and press enter. I am not sure what is wrong with my code. I don't see any syntax errors and I don't believe I have misused the array either.

New Topic/Question
Reply



MultiQuote


|