error C2664: 'bi' : cannot convert parameter 1 from 'int' to 'int []'
#include"stdio.h"#include"string.h"#defineN6#defineM30intstu[N];structChengxue{intsco...
#include"stdio.h"
#include"string.h"
#define N 6
#define M 30
int stu[N];
struct Chengxue
{
int score;
int num;
}Ch[M];
int aver(int a,int b)
{
int aver;
aver=a/b;
return aver;
}
void bi(int a[],int b[])
{
int i;
printf("及格的同学有:\n");
for(i=0;i<30;i++)
if(a[i]>=60)
printf("%d:%d\n",b[i],a[i]);
}
void fen(int a[])
{
int i;
for(i=0;i<30;i++)
{
if(a[i]<60&&a[i]>0) stu[0]++;
else if(a[i]<70&&a[i]>=60) stu[1]++;
else if(a[i]<80&&a[i]>=70) stu[2]++;
else if(a[i]<90&&a[i]>=80) stu[3]++;
else if(a[i]<100&&a[i]>=90) stu[4]++;
else if(a[i]==100) stu[5]++;
}
}
void devid()
{
printf("*************************************************\n");
}
void main()
{
int i,b,d=0,sum=0,count=0;
int j;
printf("请按学号顺序输入学生0-100之间的成绩,回车键确认,输入负值时输入完成\n");
printf("学号 :成绩\n");
for(j=2014101,i=0;j<=2014130,i<M;i++,j++)
Ch[i].num=j;
for(i=0;i<M;i++)
{printf("%d:",Ch[i].num);
scanf("%d",&b);
d++;
Ch[i].score=b;
if(b<60&&b>0)
count++;
if(b<0)
break;
sum+=b;}
devid();
printf("不及格人数为:%d\n不及格的有:\n",count);
for(i=0;i<M;i++)
if(Ch[i].score<60&&Ch[i].score>0)
printf("%d:%d\n",Ch[i].num,Ch[i].score);
devid();
printf("班级平均分为:%d\n",aver(sum,d-1));
bi(Ch[M].score,Ch[M].num);
devid();
fen(Ch[M].score);
printf("各阶段所占百分比:\n");
printf("60分一下:%d%%\n",100*stu[0]/(d-1));
printf("60-69分:%d%%\n",100*stu[1]/(d-1));
printf("70-79分:%d%%\n",100*stu[2]/(d-1));
printf("80-89分:%d%%\n",100*stu[3]/(d-1));
printf("90-99分:%d%%\n",100*stu[4]/(d-1));
printf("100分:%d%%\n",100*stu[5]/(d-1));
}
C:\Users\Administrator.QH-20150119ASUE\Desktop\Cpp1.cpp(70) : error C2664: 'bi' : cannot convert parameter 1 from 'int' to 'int []'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\Administrator.QH-20150119ASUE\Desktop\Cpp1.cpp(72) : error C2664: 'fen' : cannot convert parameter 1 from 'int' to 'int []'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast 展开
#include"string.h"
#define N 6
#define M 30
int stu[N];
struct Chengxue
{
int score;
int num;
}Ch[M];
int aver(int a,int b)
{
int aver;
aver=a/b;
return aver;
}
void bi(int a[],int b[])
{
int i;
printf("及格的同学有:\n");
for(i=0;i<30;i++)
if(a[i]>=60)
printf("%d:%d\n",b[i],a[i]);
}
void fen(int a[])
{
int i;
for(i=0;i<30;i++)
{
if(a[i]<60&&a[i]>0) stu[0]++;
else if(a[i]<70&&a[i]>=60) stu[1]++;
else if(a[i]<80&&a[i]>=70) stu[2]++;
else if(a[i]<90&&a[i]>=80) stu[3]++;
else if(a[i]<100&&a[i]>=90) stu[4]++;
else if(a[i]==100) stu[5]++;
}
}
void devid()
{
printf("*************************************************\n");
}
void main()
{
int i,b,d=0,sum=0,count=0;
int j;
printf("请按学号顺序输入学生0-100之间的成绩,回车键确认,输入负值时输入完成\n");
printf("学号 :成绩\n");
for(j=2014101,i=0;j<=2014130,i<M;i++,j++)
Ch[i].num=j;
for(i=0;i<M;i++)
{printf("%d:",Ch[i].num);
scanf("%d",&b);
d++;
Ch[i].score=b;
if(b<60&&b>0)
count++;
if(b<0)
break;
sum+=b;}
devid();
printf("不及格人数为:%d\n不及格的有:\n",count);
for(i=0;i<M;i++)
if(Ch[i].score<60&&Ch[i].score>0)
printf("%d:%d\n",Ch[i].num,Ch[i].score);
devid();
printf("班级平均分为:%d\n",aver(sum,d-1));
bi(Ch[M].score,Ch[M].num);
devid();
fen(Ch[M].score);
printf("各阶段所占百分比:\n");
printf("60分一下:%d%%\n",100*stu[0]/(d-1));
printf("60-69分:%d%%\n",100*stu[1]/(d-1));
printf("70-79分:%d%%\n",100*stu[2]/(d-1));
printf("80-89分:%d%%\n",100*stu[3]/(d-1));
printf("90-99分:%d%%\n",100*stu[4]/(d-1));
printf("100分:%d%%\n",100*stu[5]/(d-1));
}
C:\Users\Administrator.QH-20150119ASUE\Desktop\Cpp1.cpp(70) : error C2664: 'bi' : cannot convert parameter 1 from 'int' to 'int []'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\Administrator.QH-20150119ASUE\Desktop\Cpp1.cpp(72) : error C2664: 'fen' : cannot convert parameter 1 from 'int' to 'int []'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast 展开
2个回答
展开全部
#include"stdio.h"
#include"string.h"
#define N 6
#define M 30
int stu[N];
struct Chengxue
{
int score;
int num;
}Ch[M];
int aver(int a,int b)
{
int aver;
aver=a/b;
return aver;
}
void bi( int d )
{
int i;
printf("及格的同学有:\n");
for(i=0;i<d;i++)
if(Ch[i].score>=60)
printf("%d:%d\n",Ch[i].num,Ch[i].score);
}
void fen(int d)
{
int i;
for(i=0;i<d;i++)
{
if(Ch[i].score<60) stu[0]++;
else if(Ch[i].score<70) stu[1]++;
else if(Ch[i].score<80) stu[2]++;
else if(Ch[i].score<90) stu[3]++;
else if(Ch[i].score<100) stu[4]++;
else stu[5]++;
}
}
void devid()
{
printf("*************************************************\n");
}
void main()
{
int i,b,d=0,sum=0,count=0;
int j;
printf("请按学号顺序输入学生0-100之间的成绩,回车键确认,输入负值时输入完成\n");
printf("学号 :成绩\n");
for(j=2014101,i=0;j<=2014130,i<M;i++,j++)
Ch[i].num=j;
for(i=0;i<M;i++)
{
printf("%d:",Ch[i].num);
scanf("%d",&b);
if(b<=0) //
break;
d++;
Ch[i].score=b;
if(b<60)
count++;
sum+=b;
}
devid();
printf("不及格人数为:%d\n不及格的有:\n",count);
for(i=0;i<d;i++)
{
if(Ch[i].score<60)
printf("%d:%d\n",Ch[i].num,Ch[i].score);
}
devid();
printf("班级平均分为:%d\n",aver(sum,d));//
bi(d);
devid();
fen(d);
printf("各阶段所占百分比:\n");
printf("60分一下:%d%%\n",100*stu[0]/(d));
printf("60-69分:%d%%\n",100*stu[1]/(d));
printf("70-79分:%d%%\n",100*stu[2]/(d));
printf("80-89分:%d%%\n",100*stu[3]/(d));
printf("90-99分:%d%%\n",100*stu[4]/(d));
printf("100分:%d%%\n",100*stu[5]/(d));
}
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询