这里函数调用为左值为什么是错的
#include<iostream.h>int array[6][4]={ {60,80,90,75},
{75,85,65,77},
{80,88,90,98},
{89,100,78,81},
{62,68,69,75},
{85,85,77,91} };
int getLevel(int grade(int grade[],int size));
int main()
{
int typeA=0,typeB=0;
int student=6;
int gradesize=4;
for(int i=0;i<student;i++)
if(getLevel(array[i],gradesize))
{
typeA++;
}
else
{
typeB++;
}
cout<<"number of type A is "<<typeA<<endl;
cout<<"number of type B is "<<typeB<<endl;
return 0;
}
int getLevel(int grade[],int size)
{
int sum=0;
for(int i=0;i<size;i++)
sum+=grade[i];
sum/=size;
if(sum>=80)
return 1;
else
return 0;
}
--------------------Configuration: pp196 - Win32 Debug--------------------
Compiling...
pp196.cpp
f:\c++文件\p196\pp196.cpp(19) : error C2660: 'getLevel' : function does not take 2 parameters
执行 cl.exe 时出错.
pp196.obj - 1 error(s), 0 warning(s)