额,自己写的代码自己不会运行了QAQ,就是scanf那里,我输入值进去,按回车,没有反应,我知道我输入的格式错误了,但我不知道该怎样的格式输入值
#include<stdio.h>
#define N 5
#define M 7
struct competor
{
char name;
char number;
char team;
char nationality;
int lody[N][M];
}stud[N+1];
int a,b,c[N],d,e,f;
void main()
{
for (a = 0; a <N; a++)
{
scanf("%s %s %s %s ", &stud[a].name, &stud[a].number, &stud[a].team, &stud[a].nationality);
for (b = 0; b < M; b++)
{
scanf("%d ", &stud[a].lody[a][b]);
}
}
for(a=0;a<N;a++)
{
for (b = 0; b < M; b++)
{
if (stud->lody[a][b] > stud->lody[a][b])
{
d = stud->lody[a][b];
stud->lody[a][b] = stud->lody[a][b + 1];
stud->lody[a][b + 1] = d;
}
}
stud->lody[a][0] = 0;
stud->lody[a][M - 1] = 0;
for (d = 1; d < M - 1; d++)
{
e = stud->lody[a][d] + e;
}
d = e / N;
c[a] = d;
}
for(a=0;a<N;a++)
for (b = a + 1; b < N; b++)
{
if (c[a] > c[b])
{
stud[N + 1] = stud[a];
stud[a] = stud[b];
stud[b] = stud[N + 1];
f = c[a];
c[a] = c[b];
c[b] = f;
}
}
for (a = N - 1; a >N-2; a--)
{
printf("%s %s %s %s %d", stud[a].name, stud[a].number, stud[a].team, stud[a].nationality,c[a]);
}
}
struct competor
{
char name[20];
char number[20];
char team[20];
char nationality[20];
int lody[N][M];
}stud[N + 1];