Why am I getting "No matching function for call"?

Why am I getting No matching function for call when I try to call the function? Line 66, it says No matching function for call to 'inputData.

Input file:
Student Grade Sheet, Department of Computer Science, Texas State University
Fancy Peterson
A00591343
515 Lumble St., San Gabriel, TX 57982
(666) 759 - 2249
492-35-5984
22
3
CS2307
98.9
98.2
98.5
89.8
97.7
ART2308
50.9
55.2
60.5
65.8
45.7
HS2309
75.2
55.2
60.5
65.8
60.7
Student Grade Sheet, Department of Computer Science, Texas State University
Jonah Jorrddan
A00591342
511 Cumble Dr., San Gabriel, TX 57961
(555) 759 - 2249
555-35-5984
20
2
CS2307
98.9
98.2
98.5
89.8
97.7
ART2308
50.9
55.2
60.5
65.8
45.7
HS2309
60.9
55.2
60.5
65.8
60.7
Student Grade Sheet, Department of Computer Science, Texas State University
James Colemann
A00591342
410 Jumble Ln., San Gabriel, TX 57281
(777) 759 - 2249
555-25-5984
19
2
MT2306
98.9
98.2
98.5
89.8
97.7
CS2307
98.9
98.2
98.5
89.8
97.7
ART2308
50.9
55.2
60.5
65.8
45.7
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
  #include <iostream>
#include <fstream>
#include <string>
#include<iomanip>
using namespace std;

int n;  //n = number of students
const int NUMBER_OF_nonNumerical = 9;
const int NUMBER_OF_COURSES = 3;
const int NUMBER_OF_SCORES = 6;
const int THREE = 3;
const int TWO =2;

string student_nonNumeric1[3][NUMBER_OF_nonNumerical]; //store student string information
int student_numeric1 [THREE][TWO]; // store student age and years at Texas State
double courses_Numeric2 [3][NUMBER_OF_COURSES][NUMBER_OF_SCORES]; // store three students, three courses and five exams/computed average
char letterGrade [THREE][NUMBER_OF_COURSES]; // store letter grade of three students and three courses

//function prototypes
void inputData(int n, string student_nonNumeric1[n][NUMBER_OF_nonNumerical],
               int student_numeric1 [THREE][TWO],
               int courses_Numeric2 [n][NUMBER_OF_COURSES][NUMBER_OF_SCORES]);
void validateData(double);
void NumGrade(double);
void LetGrade(char);
void Comments(char);
void Reports(char);

int main()
{
    //number of students
    cout << "Enter how many students do you want to see:" << endl;
    
    cin >> n;
    // Validate the input while loop
    while ( n < 3 || n > 100 )
    {
        
        cout << "You should have at least 3 students" << endl;
        
        //get number of students again
        
        cout << "Enter how many students do you want to see:";
        
        cin >> n;
    }
    
    //Open Input and Output file
    /* ifstream fin;
    fin.open("project5_A04889172_Input.txt");
    if (!fin)
    {
        cout << "cant open1" << endl;
    }
    ofstream fout;
    fout.open("project5_A04889172_Output.txt");
    if (!fout)
    {
        cout << "cant open" << endl;
    }
     
    */

    inputData(n, student_nonNumeric1,
              student_numeric1,courses_Numeric2);
    
    //validateData(courses_Numeric2);
    
    //NumGrade(student_numeric1, courses_Numeric2);
    
    //LetGrade();
    
    //Comments();
    
    //Reports(student_numeric1);
    
    
}


void inputData(int n, string student_nonNumeric1[n][NUMBER_OF_nonNumerical],
              int student_numeric1 [THREE][TWO], int courses_Numeric2 [n][NUMBER_OF_COURSES][NUMBER_OF_SCORES])
{
    
    //Open Input and Output file
    ifstream fin;
    fin.open("project5_A04889172_Input.txt");
    if (!fin)
    {
        cout << "cant open1" << endl;
    }
    ofstream fout;
    fout.open("project5_A04889172_Output.txt");
    if (!fout)
    {
        cout << "cant open" << endl;
    }
    
    for (int i = 0; i < n; i++)
    {
        getline(fin, student_nonNumeric1[i][0]); //header;
        
        getline(fin, student_nonNumeric1[i][1]); //name
        cout << student_nonNumeric1[i][1];
        getline(fin, student_nonNumeric1[i][2]);    // Id number
        getline(fin, student_nonNumeric1[i][3]);    //address
        getline(fin, student_nonNumeric1[i][4]);    //phone number
        getline(fin, student_nonNumeric1[i][5]);    //social security
        fin >> student_numeric1[i][0];  // age
        fin >> student_numeric1[i][1];   //years at texas state
        fin.ignore();
        
        for (int j = 0; j < NUMBER_OF_COURSES; j++)
        {
            getline(fin, student_nonNumeric1[i][i]);
                    
                    for (int k = 0; k < NUMBER_OF_SCORES; k++)
                    {
                        fin >> courses_Numeric2[i][j][k];
                    }
            }
        }

}
void validateData(int student_numeric1 [THREE][TWO], int n, string student_nonNumeric1[n][NUMBER_OF_nonNumerical])
{
    
    
}
void validateData(int n, double )
{
        
}
void NumGrade()
{
    
}
void LetGrade()
{
    
}

void Comments()
{
    
}

void Reports()
{
    
}
First, avoid unnecessary use of global variables. Constants are ok.

Second first dimension of array parameter does not need value, the [] is fine and less restrictive.
In fact, how could the compiler know what value does the user give for n? It can not.
How could it generate void func( int arr[X][Y] ) if it does not know the X?
On the other hand void func( int arr[][Y], int X ) passes array of unknown size and the X.

That said:
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
#include <iostream>
#include <fstream>
#include <string>
#include<iomanip>
using namespace std;

const int NUMBER_OF_nonNumerical = 9;
const int NUMBER_OF_COURSES = 3;
const int NUMBER_OF_SCORES = 6;
const int THREE = 3;
const int TWO =2;

//function prototypes
void inputData( int n, string student_nonNumeric1[][NUMBER_OF_nonNumerical],
                int student_numeric1 [][TWO],
                int courses_Numeric2 [][NUMBER_OF_COURSES][NUMBER_OF_SCORES] );

int main()
{
    int n;
    cin >> n;

    string student_nonNumeric1[3][NUMBER_OF_nonNumerical];
    int student_numeric1 [THREE][TWO];
    double courses_Numeric2 [3][NUMBER_OF_COURSES][NUMBER_OF_SCORES];

    inputData( n,
               student_nonNumeric1,
               student_numeric1,
               courses_Numeric2 ); // error
    
}

 In function 'int main()':
30:33: error: cannot convert 'double (*)[3][6]' to 'int (*)[3][6]' for argument '4' to 'void inputData(int, std::string (*)[9], int (*)[2], int (*)[3][6])'

Note how variable courses_Numeric2 has type double [3][NUMBER_OF_COURSES][NUMBER_OF_SCORES] on line 25.
Argument 4 has type int [][NUMBER_OF_COURSES][NUMBER_OF_SCORES]
Topic archived. No new replies allowed.