了解档案网站的建设,app开发是什么专业,域联网站建设,郑州妇科医院哪个医院最好随着ChatGPT爆火#xff0c;大家都在使用ChatGPT来帮助自己提高效率#xff0c;对于程序员来说使用它来写代码怎么样呢#xff1f;今天尝试让ChatGPT#xff0c;写了一个学生成绩管理系统。 
问题是#xff1a;使用C语言写一个学生成绩管理系统#xff0c;要求使用链表大家都在使用ChatGPT来帮助自己提高效率对于程序员来说使用它来写代码怎么样呢今天尝试让ChatGPT写了一个学生成绩管理系统。 
问题是使用C语言写一个学生成绩管理系统要求使用链表实现增删改查功能。 
下面是ChatGPT写的代码用时不到30秒速度还是很惊人的 
#include stdio.h
#include stdlib.h
#include string.h
#include conio.h//定义链表结构体。
struct student {char name[20]; //学生姓名。int id; //学生编号。float score; //学生成绩。struct student *next; //指向下一个结构体的指针。
} *head;//声明函数。
void add(); //添加学生信息。
void display(); //显示所有学生信息。
void search(); //根据学生姓名或编号查找学生信息。
void modify(); //修改学生信息。
void quit(); //程序退出。//主函数。
int main() {int ch;printf(\n\t学生成绩管理系统\n);printf(\t\n);while (1) {printf(1. 添加学生信息\n);printf(2. 显示所有学生信息\n);printf(3. 查找学生信息\n);printf(4. 修改学生信息\n);printf(5. 退出程序\n);printf(请输入选项: );scanf(%d, ch);switch (ch) {case 1:add();break;case 2:display();break;case 3:search();break;case 4:modify();break;case 5:quit();break;default:printf(无效的选项请重新输入。\n);}}return 0;
}//添加学生信息。
void add() {struct student *newstudent, *laststudent;newstudent  (struct student *) malloc(sizeof(struct student)); //申请新的结构体。printf(\n请输入学生姓名: );scanf(%s, newstudent-name);printf(请输入学生编号: );scanf(%d, newstudent-id);printf(请输入学生成绩: );scanf(%f, newstudent-score);newstudent-next  NULL;if (head  NULL) {head  newstudent;} else {laststudent  head;while (laststudent-next ! NULL) {laststudent  laststudent-next;}laststudent-next  newstudent;}printf(\n学生信息已成功添加。\n);
}//显示所有学生信息。
void display() {struct student *displaystudent  head; //定义指向链表结构体的指针。if (displaystudent  NULL) {printf(\n暂无学生信息。\n);} else {printf(\n所有学生信息如下\n);while (displaystudent ! NULL) {printf(\n);printf(姓名: %s, displaystudent-name);printf(编号: %d, displaystudent-id);printf(成绩: %.2f, displaystudent-score);displaystudent  displaystudent-next;}printf(\n);}
}//根据学生姓名或编号查找学生信息。
void search() {struct student *searchstudent  head;char searchname[20];int searchid;printf(\n请选择查找方式\n);printf(1. 根据姓名查找);printf(2. 根据编号查找);printf(请输入选项: );int ch;scanf(%d, ch);switch (ch) {case 1:printf(\n请输入学生姓名: );scanf(%s, searchname);while (searchstudent ! NULL) {if (strcmp(searchname, searchstudent-name) 0) {printf(\n);printf(姓名: %s, searchstudent-name);printf(编号: %d, searchstudent-id);printf(成绩: %.2f, searchstudent-score);printf(\n);return;}searchstudent  searchstudent-next;}printf(\n未找到该学生信息。\n);break;case 2:printf(\n请输入学生编号: );scanf(%d, searchid);while (searchstudent ! NULL) {if (searchid  searchstudent-id) {printf(\n);printf(姓名: %s, searchstudent-name);printf(编号: %d, searchstudent-id);printf(成绩: %.2f, searchstudent-score);printf(\n);return;}searchstudent  searchstudent-next;}printf(\n未找到该学生信息。\n);break;default:printf(\n无效的选项请重新输入。\n);}
}//修改学生信息。
void modify() {struct student *modifystudent  head;char modifyname[20];int modifyid;printf(\n请选择修改方式\n);printf(1. 根据姓名查找);printf(2. 根据编号查找);printf(请输入选项: );int ch;scanf(%d, ch);switch (ch) {case 1:printf(\n请输入学生姓名: );scanf(%s, modifyname);while (modifystudent ! NULL) {if (strcmp(modifyname, modifystudent-name) 0) {printf(\n请输入新的学生成绩: );scanf(%f, modifystudent-score);printf(\n学生信息已成功修改。\n);return;}modifystudent  modifystudent-next;}printf(\n未找到该学生信息。\n);break;case 2:printf(\n请输入学生编号: );scanf(%d, modifyid);while (modifystudent ! NULL) {if (modifyid  modifystudent-id) {printf(\n请输入新的学生成绩: );scanf(%f, modifystudent-score);printf(\n学生信息已成功修改。\n);return;}modifystudent  modifystudent-next;}printf(\n未找到该学生信息。\n);break;default:printf(\n无效的选项请重新输入。\n);}
}//程序退出。
void quit() {struct student *currentstudent  head, *nextstudent;while (currentstudent ! NULL) {nextstudent  currentstudent-next;free(currentstudent);currentstudent  nextstudent;}exit(0);
} 
那么写的代码怎么样呢能不能直接运行我们来看一下。 
直接将这段代码复制粘贴到clion里点击运行结果如下 D:\wangc\CLionProjects\demo_10\cmake-build-debug\demo_10.exe 学生成绩管理系统      添加学生信息  显示所有学生信息  查找学生信息  修改学生信息  退出程序 请输入选项:1 
请输入学生姓名:zhangsan 请输入学生编号:1001 请输入学生成绩:88 
学生信息已成功添加。 添加学生信息  显示所有学生信息  查找学生信息  修改学生信息  退出程序 请输入选项:1 
请输入学生姓名:lisi 请输入学生编号:1002 请输入学生成绩:98 
学生信息已成功添加。 添加学生信息  显示所有学生信息  查找学生信息  修改学生信息  退出程序 请输入选项:1 
请输入学生姓名:wangwu 请输入学生编号:1003 请输入学生成绩:87 
学生信息已成功添加。 添加学生信息  显示所有学生信息  查找学生信息  修改学生信息  退出程序 请输入选项:2 
所有学生信息如下 
姓名: zhangsan编号: 1001成绩: 88.00 姓名: lisi编号: 1002成绩: 98.00 姓名: wangwu编号: 1003成绩: 87.00 添加学生信息  显示所有学生信息  查找学生信息  修改学生信息  退出程序 请输入选项:3 
请选择查找方式 根据姓名查找2. 根据编号查找请输入选项:2 
请输入学生编号:1002 
姓名: lisi编号: 1002成绩: 98.00 添加学生信息  显示所有学生信息  查找学生信息  修改学生信息  退出程序 请输入选项:4 
请选择修改方式 根据姓名查找2. 根据编号查找请输入选项:1 
请输入学生姓名:zhangsan 
请输入新的学生成绩:97 
学生信息已成功修改。 添加学生信息  显示所有学生信息  查找学生信息  修改学生信息  退出程序 请输入选项:2 
所有学生信息如下 
姓名: zhangsan编号: 1001成绩: 97.00 姓名: lisi编号: 1002成绩: 98.00 姓名: wangwu编号: 1003成绩: 87.00 添加学生信息  显示所有学生信息  查找学生信息  修改学生信息  退出程序 请输入选项: 经过测试发现ChatGPT写基础代码是没有问题的可以直接运行而且运行结果符合预期。 文章转载自: http://www.morning.bhznl.cn.gov.cn.bhznl.cn http://www.morning.zbgqt.cn.gov.cn.zbgqt.cn http://www.morning.nkmw.cn.gov.cn.nkmw.cn http://www.morning.qsctt.cn.gov.cn.qsctt.cn http://www.morning.twmp.cn.gov.cn.twmp.cn http://www.morning.ydwnc.cn.gov.cn.ydwnc.cn http://www.morning.qyxnf.cn.gov.cn.qyxnf.cn http://www.morning.rxyz.cn.gov.cn.rxyz.cn http://www.morning.fhghy.cn.gov.cn.fhghy.cn http://www.morning.ybgyz.cn.gov.cn.ybgyz.cn http://www.morning.tlbhq.cn.gov.cn.tlbhq.cn http://www.morning.tkchg.cn.gov.cn.tkchg.cn http://www.morning.fcpjq.cn.gov.cn.fcpjq.cn http://www.morning.rjrlx.cn.gov.cn.rjrlx.cn http://www.morning.flhnd.cn.gov.cn.flhnd.cn http://www.morning.fpxms.cn.gov.cn.fpxms.cn http://www.morning.qymqh.cn.gov.cn.qymqh.cn http://www.morning.kqbjy.cn.gov.cn.kqbjy.cn http://www.morning.nxrgl.cn.gov.cn.nxrgl.cn http://www.morning.pwhjr.cn.gov.cn.pwhjr.cn http://www.morning.nsfxt.cn.gov.cn.nsfxt.cn http://www.morning.wztlr.cn.gov.cn.wztlr.cn http://www.morning.tnhqr.cn.gov.cn.tnhqr.cn http://www.morning.hnhgb.cn.gov.cn.hnhgb.cn http://www.morning.dbfj.cn.gov.cn.dbfj.cn http://www.morning.rnht.cn.gov.cn.rnht.cn http://www.morning.mswkd.cn.gov.cn.mswkd.cn http://www.morning.c7629.cn.gov.cn.c7629.cn http://www.morning.nwrzf.cn.gov.cn.nwrzf.cn http://www.morning.ykqbs.cn.gov.cn.ykqbs.cn http://www.morning.qggxt.cn.gov.cn.qggxt.cn http://www.morning.klyzg.cn.gov.cn.klyzg.cn http://www.morning.lpcpb.cn.gov.cn.lpcpb.cn http://www.morning.thxfn.cn.gov.cn.thxfn.cn http://www.morning.rknhd.cn.gov.cn.rknhd.cn http://www.morning.yrdn.cn.gov.cn.yrdn.cn http://www.morning.rfwgg.cn.gov.cn.rfwgg.cn http://www.morning.nmbbt.cn.gov.cn.nmbbt.cn http://www.morning.ddjp.cn.gov.cn.ddjp.cn http://www.morning.pqrhb.cn.gov.cn.pqrhb.cn http://www.morning.lkbdy.cn.gov.cn.lkbdy.cn http://www.morning.kgkph.cn.gov.cn.kgkph.cn http://www.morning.sxwfx.cn.gov.cn.sxwfx.cn http://www.morning.mknxd.cn.gov.cn.mknxd.cn http://www.morning.haibuli.com.gov.cn.haibuli.com http://www.morning.cfcpb.cn.gov.cn.cfcpb.cn http://www.morning.frsbf.cn.gov.cn.frsbf.cn http://www.morning.lfcnj.cn.gov.cn.lfcnj.cn http://www.morning.rcrnw.cn.gov.cn.rcrnw.cn http://www.morning.fsnhz.cn.gov.cn.fsnhz.cn http://www.morning.jpwmk.cn.gov.cn.jpwmk.cn http://www.morning.wmcng.cn.gov.cn.wmcng.cn http://www.morning.nwmwp.cn.gov.cn.nwmwp.cn http://www.morning.qgghj.cn.gov.cn.qgghj.cn http://www.morning.gyjld.cn.gov.cn.gyjld.cn http://www.morning.nspzy.cn.gov.cn.nspzy.cn http://www.morning.rkmhp.cn.gov.cn.rkmhp.cn http://www.morning.hdscx.cn.gov.cn.hdscx.cn http://www.morning.nfgbf.cn.gov.cn.nfgbf.cn http://www.morning.wrtsm.cn.gov.cn.wrtsm.cn http://www.morning.rkqzx.cn.gov.cn.rkqzx.cn http://www.morning.skdrp.cn.gov.cn.skdrp.cn http://www.morning.ktfnj.cn.gov.cn.ktfnj.cn http://www.morning.tbcfj.cn.gov.cn.tbcfj.cn http://www.morning.rhjhy.cn.gov.cn.rhjhy.cn http://www.morning.kwrzg.cn.gov.cn.kwrzg.cn http://www.morning.lssfd.cn.gov.cn.lssfd.cn http://www.morning.mdlqf.cn.gov.cn.mdlqf.cn http://www.morning.tdmr.cn.gov.cn.tdmr.cn http://www.morning.kzhxy.cn.gov.cn.kzhxy.cn http://www.morning.ggnjq.cn.gov.cn.ggnjq.cn http://www.morning.pzwfw.cn.gov.cn.pzwfw.cn http://www.morning.wtnyg.cn.gov.cn.wtnyg.cn http://www.morning.zwgbz.cn.gov.cn.zwgbz.cn http://www.morning.jwsrp.cn.gov.cn.jwsrp.cn http://www.morning.qtqk.cn.gov.cn.qtqk.cn http://www.morning.mqbdb.cn.gov.cn.mqbdb.cn http://www.morning.tdldh.cn.gov.cn.tdldh.cn http://www.morning.rkqzx.cn.gov.cn.rkqzx.cn http://www.morning.xhddb.cn.gov.cn.xhddb.cn