这题求教到底是哪里错了
#include<stdio.h>#define M 10
#define N 5
void main()
{
void fac(char x[][]);
void average1(char x[][]);
void average2(char x[][]);
void high(char x[][]);
int a;
fac(a);
average1(a);
average2(a);
high(a);
}
void fac(char x[][])
{
int i,j;
printf("请输入十个学生的五门成绩:\n");
for(i=0;i<M;i++)
for(j=0;j<N;j++)
{
scanf("%d",&x);
}
}
void 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;
}
average=sum/M;
}
printf("每门个学生的平均分是:\n");
}
void 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;
}
average=sum/N;
}
printf("每门课的平均分是:\n",average);
}
void high(char x[][])
{
int max,m,n,i,j;
max=x;
for(i=0;i<M;i++)
for(j=0;j<N;j++)
if(max<x)
{
max=x;
m=i;
n=j;
}
printf("最高分数是第%d个学生的第%d个\n",m,n);
} 哥们,至少要把报错信息贴上来吧?!{:10_266:} --------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xd3'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xe3'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xc2'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xdb'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xcc'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xb3'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xb0'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xe6'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xd6'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xf7'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xd5'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xd0'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xc6'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2018: unknown character '0xb8'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(2) : error C2014: preprocessor command must start as first nonwhite space
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(5) : error C2144: syntax error : missing ';' before type 'void'
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(5) : error C2501: 'C' : missing storage-class or type specifiers
d:\迅雷下载\common\msdev98\bin\cpp1.cpp(5) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
Cpp1.obj - 1 error(s), 0 warning(s)
循环没有嵌套?? 哪里没有嵌套,能提醒一下么
一阳 发表于 2016-5-30 12:02
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
这是你自己写的吧?你们是不是用的是老谭的教材?思路完全不对呀{:10_262:} ~风介~ 发表于 2016-6-1 09:42
这是你自己写的吧?你们是不是用的是老谭的教材?思路完全不对呀
啥思路?
#include<stdio.h>
#define M 10
#define N 5
void main()
{
void fac(char x[][]);
void average1(char x[][]);
void average2(char x[][]);
void high(char x[][]);
int a;
fac(a);
average1(a);
average2(a);
high(a);
}
void fac(char x[][])
{
int i,j;
printf("请输入十个学生的五门成绩:\n");
for(i=0;i<M;i++)
for(j=0;j<N;j++)
{
scanf("%d",&x);
}
}
void 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;
}
average=sum/M;
}
printf("每门个学生的平均分是:\n");
}
void 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;
}
average=sum/N;
}
printf("每门课的平均分是:\n",average);
}
void high(char x[][])
{
int max,m,n,i,j;
max=x;
for(i=0;i<M;i++)
for(j=0;j<N;j++)
if(max<x)
{
max=x;
m=i;
n=j;
}
printf("最高分数是第%d个学生的第%d个\n",m,n);
}
为什么错呢@FishC_GPT
页:
[1]