Function Names not matching?

I'm trying to write a program and it has to put quiz values into an array, one requirement is to build a separate function to build the initial array. I made the function but when I go to call in main() Xcode says there is an error, "no matching function to call for buildQuizArray" even though I literally copied and pasted the name into the main(). I'm still in the beginning stages of the code so right now I'm just trying to check and see if the buildQuizArray will even work but I can't call it in the main(). The error comes on line 40. Thanks.

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>


using namespace std;

//Symbolic Constants
int quizArray[12];
int Max_array = 12;



int buildQuizArray(int quizArray[])
{
    int quizScore = 0;
    int numberOfQuizzes = 0;
    for (int i = 0; i < quizArray[Max_array]; i++)
    {
        cout << "Enter your score for quiz " << (i + 1) << " (-1 to quit): " << endl;
        cin >> quizScore;
        while (quizScore != -1 && quizScore >= 0)
        {
            quizArray[i] = quizScore;
            quizScore = 0;
            numberOfQuizzes++;
        }
    }
    return numberOfQuizzes;
}




int main()
{
    int quiz_number = 0;
    
    quiz_number = buildQuizArray( quizArray[12]);
    cout << quiz_number;
    
    return 0;
}
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>

using namespace std;

int Max_array = 12;
int quizArray[12];

int buildQuizArray()
{
    int quizScore = 0;
    int numberOfQuizzes = 0;
    
    for (int i = 0; i < Max_array; i++) ///
    {
        cout << "Enter your score for quiz " << (i + 1) << " (-1 to quit): " << endl;
        cin >> quizScore;
        if(quizScore==-1) break; ///
        if ( quizScore >= 0) ///
        {
            quizArray[i] = quizScore;
            ///quizScore = 0;
            numberOfQuizzes++;
        }
        
    }
    return numberOfQuizzes;
}

int main()
{
    int quiz_number = 0;
    
    quiz_number = buildQuizArray( ); /// you dont need send argument if you use global variable
    cout << quiz_number;
    
    return 0;
}
Topic archived. No new replies allowed.