|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
#define M 10
#define N 5
int fac(char x[][]);
int average1(char x[][]);
int average2(char x[][]);
int high(char x[][]);
int main()
{
int a[M][N];
fac(a);
average1(a);
average2(a);
high(a);
return 0;
}
int fac(char x[][])
{
int i,j;
printf("请输入十个学生的五门成绩:\n");
for(i=0;i<M;i++)
for(j=0;j<N;j++)
{
scanf("%d",&x[i][j]);
}
return 0;
}
int average1(char x[][])
{
int i,j,sum,average;
sum=0;
average=0;
for(i=0;i<M;i++)
{
for(i=0;j<N;j++)
{
sum=sum+x[i][j];
}
average=sum/M;
}
printf("每门个学生的平均分是:\n",average1);
return average;
}
int average2(char x[][])
{
int i,j,sum,average;
sum=0;
average=0;
for(j=0;j<N;j++)
{
for(i=0;i<M;i++)
{
sum=sum+x[j][i];
}
average=sum/N;
}
printf("每门课的平均分是:\n",average);
return average;
}
int high(char x[][])
{
int max,m,n,i,j;
max=x[0][0];
for(i=0;i<M;i++)
for(j=0;j<N;j++)
if(max<x[i][j])
{
max=x[i][j];
m=i;
n=j;
}
printf("最高分数是第%d个学生的第%d个\n",m,n);
}
问题
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(4) : error C2087: '<Unknown>' : missing subscript
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(5) : error C2087: '<Unknown>' : missing subscript
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(6) : error C2087: '<Unknown>' : missing subscript
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(7) : error C2087: '<Unknown>' : missing subscript
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(11) : error C2664: 'fac' : cannot convert parameter 1 from 'int [10][5]' to 'char [][1]'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(12) : error C2664: 'average1' : cannot convert parameter 1 from 'int [10][5]' to 'char [][1]'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(13) : error C2664: 'average2' : cannot convert parameter 1 from 'int [10][5]' to 'char [][1]'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(14) : error C2664: 'high' : cannot convert parameter 1 from 'int [10][5]' to 'char [][1]'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(17) : error C2087: '<Unknown>' : missing subscript
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(28) : error C2087: '<Unknown>' : missing subscript
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(44) : error C2087: '<Unknown>' : missing subscript
D:\迅雷下载\Common\MSDev98\Bin\Cpp1.cpp(60) : error C2087: '<Unknown>' : missing subscript
执行 cl.exe 时出错. |
|