Hello gus2427,
To start with you could use some blank lines in your code.
The first error that came up deals with the end of the "enterScores" function. You are calling the "printScores" function before it has been compiled so the compiler does not know about it yet. You should move the "printScores" function to main.
A function should do only one thing.
After you correct what
Ganado has told you next is
printScores(scores, 6);
at the end of "enterScores". If the array only has room for 5 columns then why are you sending the function 6. In the "print" function you will be trying to read past the end of the array. This may not be a runtime error, but you will be printing garbage because it is outside of the array.
Just to give yo an idea about blank lines:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
void printScores(int scores[ArryRow][ArryCol], int games)
{
for (int i = 0; i < ArryRow; i++)
{
for (int j = 0; j < ArryCol; j++)
{
cout << std::setw(3) << scores[i][j];
}
cout << '\n';
}
cout << endl;
}
int main()
{
int scores[ArryRow][ArryCol];
enterScores(scores, 5);
printScores(scores, 5);
return 0; // <--- Not required, but makes a good break point.
}
|
One last point. You are sending an "int" for the size of the number of "games", but in the "print" function you never use it nor need it.
In your for loops you define the loop iterator as a "size_t", or "unsigned int", then compare the size_t to an int. this is a type mismatch and should be a compiler warning.The "size_t" should be an "int"
Andy