the following code is supposed to read an array of exam scores for a lecture section of up to max_size students. But I am getting an error that follows the code, could someone kindly help figure what is wrong with this code:
thanks,
upad
-----------------------------------
# include <iostream>
# include <cmath>
# include <string>
using namespace std;
const int max_size=5;
void readScores(int, int, int&);
int main()
{
int scores[max_size];
int sectionSize=0;
readScores(scores[max_size], max_size, sectionSize);
system ("pause");
return 0;
}
void readScores(int scores[], int max_size, int& sectionSize)
{
const int SENTINEL=-1;
int tempScore;
cout << "Enter next score after the prompt or enter " << SENTINEL << " to stop." << endl;
sectionSize=0;
1) above suggestion (readScores(scores, max_size, sectionSize);) is giving the following error:
error C2664: 'readScores' : cannot convert parameter 1 from 'int [5]' to 'int'
1> There is no context in which this conversion is possible
-------------------------------------------------------------------------------------------------------------------
2) also scores[5] implies array size and not the subscript, so I'm thinking there is nothing wrong with that.
Having said that, I am still not sure how to correct the above code...any help??