I have a general program that compiles but does not run properly. I have set flags in the program to pinpoint where the error is. Here is the function where the problem arises:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
float* inputScores() // fills an array of the judges' scores via for loop
{
//float scoreArray[7];
float userInput; // input made by the user
for(int incrementor = 0; incrementor < NUMBER_OF_JUDGES; incrementor++){ // loop that will continue for how many judges there are
cout << "Please enter the score for Judge "
<< incrementor + 1 << ".(0 - 10)\n";
cin >> userInput; // receives user input
scoreArray[incrementor] = userInput; // fills array with individual user inputs
cout << scoreArray[incrementor];
}
return scoreArray;
}
I have made scoreArray and NUMBER_OF_JUDGES global variables.
The program builds with no errors. When the last input of the For loop is entered, the program stops and this error occurs:
RUN FAILED (exit value 1, total time: 6s)
I have tried increasing the size of the array so I make sure there is enough room, but to no avail. Also, I have put some random cout's to make sure the For loops or the function finishes and it seems the program just stops at line 9 during the last loop.