#include <stdio.h>
#include <stdlib.h>
struct studen
{
long num;
float score;
struct studen *next;
}*p1,*p2,*head,*p,*stu,stu_2;
int main()
{
extern struct studen *create();
extern struct studen *del(struct studen *head,int nun);
extern int print(struct studen *p);
extern struct studen *input(struct studen *head,struct studen *stu_2);
char qd='1';
int nun=0,p=1;
stu=create();
print(stu);
while(qd!='Y' && qd!='N')
{
printf("需要删除吗?[Y,N]:");
scanf("%s",&qd);
}
if(qd=='N')
{
printf("请输入需要插入的数的num:");
scanf("%d",&stu_2.num);
printf("请输入需要插入的数的score:");
scanf("%f",&stu_2.score);
stu=input(stu,&stu_2);
qd='1';
while(qd!='N')
{
printf("需要继续插入吗?[Y,N]:");
scanf("%s",&qd);
if(qd=='Y')
{
printf("请输入需要插入的数的num:");
scanf("%d",&stu_2.num);
printf("请输入需要插入的数的score:");
scanf("%f",&stu_2.score);
stu=input(stu,&stu_2);
}
}
}
else
{
printf("请输入需要删除的数的num:");
scanf("%d",&nun);
stu=del(stu,nun);
while(1)
{
printf("需要继续删除吗?[Y,N]:");
scanf("%s",&qd);
if(qd=='Y')
{
printf("请输入需要继续删除的数的num:");
scanf("%d",&nun);
stu=del(stu,nun);
}
else if(qd=='N')
{
break;
}
}
printf("请输入需要插入的数的num:");
scanf("%d",&stu_2.num);
printf("请输入需要插入的数的score:");
scanf("%f",&stu_2.score);
stu=input(stu,&stu_2);
qd='1';
while(1)
{
printf("需要继续插入吗?[Y,N]:");
scanf("%s",&qd);
if(qd=='Y')
{
printf("请输入需要插入的数的num:");
scanf("%d",&stu_2.num);
printf("请输入需要插入的数的score:");
scanf("%f",&stu_2.score);
stu=input(stu,&stu_2);
}
else if(qd=='N')
{
break;
}
}
print(stu);
}
print(stu);
}
谁能看看这个程序哪错了。
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- threenewbee 2019-05-30 20:51关注
scanf("%s",&qd);
if(qd=='Y')
{
->
scanf("%c",&qd);
if(qd=='Y')
{本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 nginx中的CORS策略应该如何配置
- ¥30 信号与系统实验:采样定理分析
- ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
- ¥20 Vite 打包的 Vue3 组件库,图标无法显示
- ¥15 php 同步电商平台多个店铺增量订单和订单状态
- ¥15 关于logstash转发日志时发生的部分内容丢失问题
- ¥17 pro*C预编译“闪回查询”报错SCN不能识别
- ¥15 微信会员卡接入微信支付商户号收款
- ¥15 如何获取烟草零售终端数据
- ¥15 数学建模招标中位数问题