- #1
sdoug041
- 26
- 0
hello. I am working on a c++ assignment right now, and my job is to write a sub-program that will fill two arrays with random numbers (1-10), then ask the student 10 arithmetic questions (either multiply or divide depending on a previous choice) and store the answers in a third arrray. I come across problems when trying to call the function and returning the array from the function. (the answers)
in the main () i have something like
int student_answers [10];
student_answers [10] = run_test ();
the above 3 lines are an attempt to call the function but I have limited knowledge about arrays.
in the sub-program itself I have something like:
int run_test (int verification)
... bunch of code... stores answers in answer[10]
return (answers[10]);
is ths the correct way of returning an array?
in the main () i have something like
int student_answers [10];
student_answers [10] = run_test ();
the above 3 lines are an attempt to call the function but I have limited knowledge about arrays.
in the sub-program itself I have something like:
int run_test (int verification)
... bunch of code... stores answers in answer[10]
return (answers[10]);
is ths the correct way of returning an array?
Last edited: