C语言排错

来源:百度知道 编辑:UC知道 时间:2024/09/23 12:26:45
#include <stdio.h>
#define N 5
struct student
{
char num[10];
char name[10];
float yw;
float shx;
float wy;
float ave;
};
struct student a[N];

void main()
{
char number[10];
int i,j;
puts("Please Enter Number,Name,3 scores:");
for(i=0;i<N;i++)
{
scanf("%s",a[i].num);
scanf("%s",a[i].name);
scanf("%f",&a[i].yw);
scanf("%f",&a[i].shx);
scanf("%f",&a[i].wy);
}
}

/*不能正常输入*/

#include <stdio.h>
#define N 5
struct student
{
char num[10];
char name[10];
float yw;
float shx;
float wy;
float ave;
};
struct student a[N];

void main()
{
char number[10];
int i,j;
puts("Please Enter Number,Name,3 scores:");
for(i=0;i<N;i++)
{
scanf("%s",a[i].num);
scanf("%s",a[i].name);
float temp=0;
scanf("%f",&temp);
a[i].yw=temp;
scanf("%f",&temp);
a[i].shx=temp;
scanf("%f",&temp);
a[i].wy=temp;
}
}