This program is supposed to take integer score inputs from the keyboard into an array and use a sentinel of -999 to end the process.It should call a show() function which passes the array and displays the name and number of the integer for the output. I am not to sure on this program but can anyone help me.
# include <iostream>
usingnamespace std;
int main()
{
int score(double array1[], int numbers);
double s[100]={};
double integer;
score (s, 100); //call to the fucntion to populate array
cout << "The integer scores are" << integer << endl;
system("pause");
return (0);
//Populates the array
int worker(double array1[], int numbers);{
double input=1;
int r;
while (input != -999){
for (r=0; r<numbers; i++){
cout << "Enter a number " << endl;
cin >> input;
array1[r]=input;
}
}
system ("pause");
return i;
}
I am getting an error in the for loop r<number which states "Error identifier "numbers" is undefined" and on my array1 "Error identifier "array1" us undefined" also in my for loop.
I have been looking and looking for a few hours and I cannot figure it out. I think I need a fresh set of eyes.
On line 17, you tried to define a function inside of the main function. You cannot do this. However, you also accidentally put a semicolon there, so the compiler sees you as declaring that a function exists, and then writing more code in the main function.
Try going back to basics. Your program requirements are that it needs a function to take in scores and a function to show the scores. Try just writing the declarations, but not the definitions, of those functions, and then write your main function.