C语言代码求助

#pragmawarning(disable:4996)#include<stdio.h>#include<stdlib.h>intcount;structStudent... #pragma warning(disable : 4996)
#include<stdio.h>
#include<stdlib.h>
int count;
struct Student
{
char name[30];
int ID;
float Chinese;
float Math;
float English;
struct Student *next;
};
struct Student* Create(int Long)
{
struct Student *head = NULL;
struct Student *new;
struct Student *end;
new = end = (struct Student*)malloc(sizeof(struct Student));
count = 0;
printf("请输入第%d个同学的名字:\n", (count + 1));
scanf("%s", new->name);
printf("请输入第%d个同学的学号:\n", (count + 1));
scanf("%d", &new->ID);
printf("请输入第%d个同学的语文成绩:\n", (count + 1));
scanf("%f", &new->Chinese);
printf("请输入第%d个同学的数学成绩:\n", (count + 1));
scanf("%f", &new->Math);
printf("请输入第%d个同学的英语成绩:\n", (count + 1));
scanf("%f", &new->English);
while (1)
{
count++;
if (count = 1)
{
new->next = NULL;
head = new;
end = head;
}
else
{

new->next = NULL;
end->next = new;
end = new;
}
if (count = Long)
goto a;
new = (struct Student*)malloc(sizeof(struct Student));
printf("请输入第%d个同学的名字:\n", (count + 1));
scanf("%s", new->name);
printf("请输入第%d个同学的学号:\n", (count + 1));
scanf("%d", &new->ID);
printf("请输入第%d个同学的语文成绩:\n", (count + 1));
scanf("%f", &new->Chinese);
printf("请输入第%d个同学的数学成绩:\n", (count + 1));
scanf("%f", &new->Math);
printf("请输入第%d个同学的英语成绩:\n", (count + 1));
scanf("%f", &new->English);
}
a:
free(new);
return head;
}
int main()
{
struct Student *head;
int Long, i, b;
b = 0;
printf("请输入要记录学生的数量:\n");
scanf("%d", &Long);
head = Create(Long);
printf("成绩少于60分的同学:\n");
for (i = 1; i <= count; i++)
{
if ((head->Chinese < 60) || (head->Math < 60) || (head->English < 60))
{
printf("名字:%s\n", head->name);
printf("学号:%d\n", head->ID);
printf("语文成绩:%f\n", head->Chinese);
printf("数学成绩:%f\n", head->Math);
printf("英语成绩:%f\n", head->English);
printf("======================================\n");
b++;
}
head = head->next;
}
if (b = 0)
printf("没有人不及格!\n");
return 0;
}
================
如代码,我原本想实现的是通过链表来储存学生数据,并输出不及格的同学信息,但不知为何总是有错,求各位大神看一看
展开
 我来答
Yuqi_Tan

2018-11-16 · TA获得超过8.9万个赞
知道大有可为答主
回答量:9918
采纳率:93%
帮助的人:3464万
展开全部
1、if(count=1)和if(count=Long)两句中的等号要改成双等号。
2、程序第一次出现Long的时候,Long还没有定义!
追问

还是很怪

追答
把free(new);这一句去掉!
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式