C++ 我的程序显示了许多错误;错误:对';的调用没有匹配函数;getPercentScore'&引用;

C++ 我的程序显示了许多错误;错误:对';的调用没有匹配函数;getPercentScore'&引用;,c++,C++,我有一个程序,必须读取两个输入文件,并从这两个文件中排序一些数据。我已经解决了大部分问题,但我一直试图将更严格的数组传递到我的函数中,但它不起作用 int main() { int labNumber=8; string labName = "MATH ANYONE"; printHeader(labName, labNumber); ifstream infile; //INPUT input file stream s

我有一个程序,必须读取两个输入文件,并从这两个文件中排序一些数据。我已经解决了大部分问题,但我一直试图将更严格的数组传递到我的函数中,但它不起作用

int main()
{
    int labNumber=8;
    string labName = "MATH ANYONE";
    printHeader(labName, labNumber);

    ifstream    infile;             //INPUT input file stream

    struct test {
        string firstName;           //INPUT student first name
        string lastName;            //INPUT student last name
        string tempfirstName;       //INPUT temporary first name used to place into actual
        string templastName;        //INPUT temporary last name used to place into actual
        string tempId;              //INPUT temporary id used to compare with actual
        string studentId;           //INPUT student id
        double courseScore;         //OUTPUT student score %
        char courseGrade;           //OUTPUT student letter grade
        string answers;             //INPUT student answer
    };
    test *table[30];
这只是我代码的一部分;我有一个名为functions.cpp的输入文件

    for (int i=0;i<studentCount;i++)
    {
        double percent=0;
        getPercentScore(table[30], key);
    }

for(int i=0;i首先,尝试创建测试数组:

test table[30];
在functions.cpp中,将函数getPercentScore()声明为:

另外,用tbl替换getPercentScore()主体内的任何表引用

如果希望知道数组的大小,请将其作为额外参数传递,如:

size_t size = sizeof(table) / sizeof(test);
for (int i=0;i<studentCount;i++)
{
    double percent=0;
    getPercentScore(table, size, key);
}
size\u t size=sizeof(表)/sizeof(测试);

对于(int i=0;i注意,如果您声明
test*table[30];
,以后使用
table[30]
将导致麻烦。如果您通过
test[30]
,您将数组的一个单独位置传递给该方法。我想您的意思是
getPercentScore(test[i],key)
在你的循环中?你忘记发布所有的#include指令。它们很重要,在发布你的问题之前,千万不要将它们编辑掉。
double getPercentScore(test tbl[], string key) 
size_t size = sizeof(table) / sizeof(test);
for (int i=0;i<studentCount;i++)
{
    double percent=0;
    getPercentScore(table, size, key);
}