So for my class assignment I have to do this grade book program. The part I'm struggling with is figuring out how to pass a string array from one function to another, such that the latter function can perform calculations on the data stored in the string array. Well, zooming out further to the bigger picture, the string array (which is for student names) is parallel to a double array (which is for scores), and the function receiving the arrays must find highest and lowest, calculate mean, and print output to screen and file. I get all that last bit, but I can't figure out correct syntax for referring arrays to a function WITHOUT USING VECTORS!
IMPORTANT: In case you somehow missed it, we are not allowed to use vectors for this assignment.
so the general outline is:
//blahblahblah, #includes and other starting things
int myFunc(//prototype-what the heck goes here?)
int main()
{
//arrays declared
string names[MAX_NUM];
double scores[MAX_NUM];
//...other stuff main does, including calling myFunc...
}
int myFunc( //header-what the heck goes here?)
{
//Code here to find highest, lowest, and mean scores from data in scores[]
}
Obviously what is in each indicated "what the heck goes here?" location will be related to what's in the other. But I don't know how to make it all work and every answer I've been able to find just says to use vectors. Which we haven't covered yet and therefore cannot use... Help, please?
std::array(C++11) has a cleaner syntax than C-array.