当前位置:首页 > 通信资讯 > 正文

1.课程设计目的

1.更好的理解c语言的相关实现内容,对于c语言的理解得到更好的帮助。
2.实现更方便快捷的应用。

2.基本要求

(1)、1.每组完成1个题目的设计;每人独立完成该题目的一个功能模块的实现,并将课程设计报告打印、装订提交。
(2).使用标准c语言编制程序,源代码必须采用锯齿型书写格式,必须上机调试通过。运行界面友好,易于操作。 (3).输出要求: 1)
应用程序正常运行后,要在屏幕上显示一个文字菜单;2)
要求用户输入数据时,要给出清晰、明确的提示信息,包括输入的数据内容、格式等;3)为各项操作功能设计一个菜单,应用程序运行后,先显示这个菜单,然后用户通过菜单项选择希望进行的操作项目。
(4).必须实现所要求的全部功能。 (5).课程设计要求独立完成,不得抄袭。若发现抄袭行为,则成绩一律记零分。

3.任务完成情况

1.可以通过程序实现学生信息的增加删除显示查找以及修改功能。
2.通过非链表的方式运用结构体的方法编写程序。

4.设计报告

4.1需求分析

4.1.1用户需求分析

(1)、可以快速度的找出输入的学生的所有信息。 (2)、可以精确的找出某个学生的所有信息。 (3)、需要准确的修改某个学生的成绩。

4.2概要设计

1.增加信息。
2.显示信息。
3.查找信息。
4.删除信息。
5.修改信息。

4.3详细设计

4.3.1程序流程图

c语言用链表写学生管理系统(c++用链表实现学生信息管理系统)

4.4详细代码

4.4.1结构体定义

typedef struct//定义了一个结构体变量 { char stu_name[10]; //表示姓名 int
stu_id; //表示学号 double stu_math; //高数成绩 double
stu_english; //大学英语成绩 } student;

4.4.2主函数

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

4.4.3初始化函数

student all_stu[10]; int stu_number=0;//定义了学生的人数 int main()

4.4.4显示菜单函数

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 void first();//一号条件 void secend();//二号条件 void third();//三号条件 void fourth();//四号条件 void fifth(); int q; do printf("\n\n\n\n printf("\t\t=学生成绩管理系统\n"); printf("\t\t* \n"); printf("\t\t 1. 输入学生成绩 \n"); printf("\t\t 2. 查找学生成绩 \n"); printf("\t\t 3. 显示所有成绩 \n"); printf("\t\t 4. 删除学生成绩 \n"); printf("\t\t 5. 修改学生成绩 \n"); printf("\t\t 0. 退出管理系统 \n"); printf("\t\t printf("\t\t=========================================\n); printf("\t\t输入你的选项:"); scanf("%d",&q); switch(q) { case 1: first(); printf(“按任意键回菜单”); getchar(); system(“cls”);//表示转移号 break; case 2: secend(); getchar(); printf(“按任意键回菜单”); getchar(); system(“cls”); break; case 3: third(); getchar(); printf("\n请按任意键返回主菜单\n"); getchar(); system(“cls”); break; case 4: fourth(); getchar(); printf("\n按任意键返回主菜单\n"); getchar(); system(“cls”); break; case 5: fifth(); getchar(); printf("\n按任意键回主菜单\n"); getchar(); system(“cls”); break; } }while(q); return 0;

4.4.5显示各个功能函数

4.4.5.1增加信息

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 void first() { thefirst: system("cls"); printf("************输入学生信息**********); printf("\n\n"); int cw,temp,hh; char op; stu_number++; printf("\n>>>>>>>>请输入姓名: "); scanf("%s",all_stu[stu_number].stu_name); printf("\n>>>>>>>>请输入学号: "); scanf("%d",&temp); all_stu[stu_number].stu_id=temp; getchar();//接收一个空格 printf("\n>>>>>>请输入高等数学成绩(小于等于100):"); scanf("%lf",&all_stu[stu_number].stu_math); if (all_stu[stu_number].stu_math> 100) { printf("输入有误,请输入正确的成绩信息,请按(y)重新输入: "); getchar(); cw = getchar(); if (cw =='y'|| cw =='y') goto thefirst; } printf("\n>>>>>>>>请输入大学英语成绩(小于等于100):"); scanf("%lf", &all_stu[stu_number].stu_english); if (all_stu[stu_number].stu_english> 100) { printf("输入有误,请输入正确的成绩信息,请按(y)重新输入: "); getchar();//接收y cw = getchar(); if (cw == 'y' || cw == 'y') goto thefirst; } thefirstone: printf("\n是否继续输入,如是请按(y),否请按(n): "); getchar(); scanf("%c", &op); if (op == 'y' || op == 'y') goto thefirst; if (op == 'n' || op == 'n') goto thefirstend; else goto thefirstone; getchar(); thefirstend:; getchar();//输入任意数结束 }

4.4.5.2查找信息

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 void fourth() { thefourth: system("cls"); printf("\n\n\n\n********************删除学生成绩**********************"); int num,cw,cx,ai,i=0; char op; printf("\n>>>>>>>>请输入要查找学生的学号: "); scanf("%d",&num); for (ai=1;ai<=stu_number;ai++) { if (num==all_stu[ai].stu_id) { i=1; break; } } if (i==0) { printf("未查找到要删除的学生信息,是否要重新输入,如需要重新输入请按(y),如不需要请按(n)将返回主菜单: "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefourth;//回到开始 if (cw == 'n' || cw == 'n') goto thefourthend;//回到结尾 } else { stu_number--;//人数减一 for (;ai<stu_number;ai--) { all_stu[ai] = all_stu[ai+1];//后面的数据往前推 } } printf("\n\n此学号的学生成绩信息已删除"); getchar(); thefourthone: getchar(); printf("\n删除的成绩信息以删除,是否继续?\n需要请(y),如不需要请(n),将返回主界面: "); scanf("%c", &op); if (op == 'y' || op == 'y') goto thefourth; if (op == 'n' || op == 'n') goto thefourthend; else goto thefourthone; thefourthend:; }

4.4.5.3显示信息

?
1 2 3 4 5 6 7 8 > void third() { thethird: system("cls"); > printf("\n\n**************************显示学生信息***********************"); > int n=1; printf("\n\n>>>姓名"); printf("\t学号"); printf("\t高等数学"); > printf("\t大学英语"); //for (n=0;n<stu_number;n++); do { > printf("\n>>%s", all_stu[n].stu_name); printf("\t%d", > all_stu[n].stu_id); printf("\t%.2lf", all_stu[n].stu_math); > printf("\t%.2lf", all_stu[n].stu_english); n++; } while > (n<=stu_number); }

4.4.5.4删除信息

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 void fourth() { thefourth: system("cls"); printf("\n\n\n\n********************删除学生成绩**********************"); int num,cw,cx,ai,i=0; char op; printf("\n>>>>>>>>请输入要查找学生的学号: "); scanf("%d",&num); for (ai=1;ai<=stu_number;ai++) { if (num==all_stu[ai].stu_id) { i=1; break; } } if (i==0) { printf("未查找到要删除的学生信息,是否要重新输入,如需要重新输入请按(y),如不需要请按(n)将返回主菜单: "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefourth;//回到开始 if (cw == 'n' || cw == 'n') goto thefourthend;//回到结尾 } else { stu_number--;//人数减一 for (;ai<stu_number;ai--) { all_stu[ai] = all_stu[ai+1];//后面的数据往前推 } } printf("\n\n此学号的学生成绩信息已删除"); getchar(); thefourthone: getchar(); printf("\n删除的成绩信息以删除,是否继续?\n需要请(y),如不需要请(n),将返回主界面: "); scanf("%c", &op); if (op == 'y' || op == 'y') goto thefourth; if (op == 'n' || op == 'n') goto thefourthend; else goto thefourthone; thefourthend:; }

4.4.5.5修改信息

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 void fifth()//修改成绩 { thefifth: system("cls"); printf("**************************修改学生成绩*************************"); printf("\n\n"); int num,cw,cx,ai,i = 0, cy, temp; char op; printf("\n>>>>>>>>请输入要查找学生的学号: "); scanf("%d", &num); for (ai=1; ai<=stu_number; ai++) { if (num ==all_stu[ai].stu_id) { i = 1; break; } } if (i == 0) { printf("未查找到要修改的学生信息,重新输入按y,返回主菜单按n "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifth; if (cw == 'n' || cw == 'n') goto thefifthend; } else { printf("***********************************************************************"); printf("\n*姓名___: "); printf("%s", all_stu[ai].stu_name); printf("\n*学号___: "); printf("%d", all_stu[ai].stu_id); printf("\n*高数成绩: "); printf("%.2lf", all_stu[ai].stu_math); printf("\n*大学英语成绩: "); printf("%.2lf",all_stu[ai].stu_english); printf("\n*********************************************************************"); } getchar(); printf("\n\n是否确认修改此学生成绩信息?(注:修改后将不可还原)如需修改请按y,如不需修改学生信息请安n返回主菜单: "); thefifthone: cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifthtwo; if (cw == 'n' || cw == 'n') goto thefifthend; else goto thefifthone; thefifthtwo: system("cls"); printf("\n>>>>>>>>请输入姓名: "); scanf("%s", all_stu[ai].stu_name); printf("\n>>>>>>>>请输入学号: "); scanf("%d",&temp); all_stu[ai].stu_id = temp; getchar(); for (cy = 0; cy < ai; cy++) { if (all_stu[ai].stu_id == all_stu[cy].stu_id) { printf("学号输入错误,如需重新输入请按(y)退出请按(n)"); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifthtwo; else goto thefifthend; } } printf("\n>>>>>>>>请输入第一门成绩(小于100): "); scanf("%lf", &all_stu[ai].stu_math); if (all_stu[ai].stu_math > 100) { printf("输入有误,请按(y)重新输入: "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifthtwo; } printf("\n>>>>>>>>请输入第二门成绩(小于100): "); scanf("%lf", &all_stu[ai].stu_english); if (all_stu[ai].stu_english > 100) { printf("输入有误,请按(y)重新输入: "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifthtwo; } printf("\n\n"); printf("\n ok 此学生成绩信息已修改完成,感谢您的使用。"); thefifthfanhui: getchar(); printf("\n成绩信息已修改,是否继续?\n需要请按y,如不需要请按y,将返回主菜单: "); scanf("%c", &op); if (op == 'y' || op == 'y') goto thefifth; if (op == 'n' || op == 'n') goto thefifthend; else goto thefifthfanhui; thefifthend:; }

4.5使用说明

本代码比较简单易懂,蒟蒻也能看懂。

4.6测试结果与分析

主界面如图:

c语言用链表写学生管理系统(c++用链表实现学生信息管理系统)

输入信息图示:

c语言用链表写学生管理系统(c++用链表实现学生信息管理系统)

查找信息如图:

c语言用链表写学生管理系统(c++用链表实现学生信息管理系统)

显示所有信息如图:

c语言用链表写学生管理系统(c++用链表实现学生信息管理系统)

删除学生信息:

c语言用链表写学生管理系统(c++用链表实现学生信息管理系统)

修改学生信息如图:

c语言用链表写学生管理系统(c++用链表实现学生信息管理系统)

c语言用链表写学生管理系统(c++用链表实现学生信息管理系统)

4.7参考文献

【1】c语言从入门到精通2020版。

5体会与感想

学习的过程很漫长,只有依靠自己的慢慢摸索,在过程中总结出经验才是学习中最重要的事情。

6附录

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 附录 #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int sum; typedef struct//定义了一个结构体变量 { char stu_name[10]; //表示姓名 int stu_id; //表示学号 double stu_math; //高数成绩 double stu_english; //大学英语成绩 } student; student all_stu[10]; int stu_number=0;//定义了学生的人数 int main() { void first();//一号条件 void secend();//二号条件 void third();//三号条件 void fourth();//四号条件 void fifth(); int q; do { printf("\n\n\n\n"); printf("\t\t=====================学生成绩管理系统=================\n"); printf("\t\t* *\n"); printf("\t\t* 1. 输入学生成绩 *\n"); printf("\t\t* 2. 查找学生成绩 *\n"); printf("\t\t* 3. 显示所有成绩 *\n"); printf("\t\t* 4. 删除学生成绩 *\n"); printf("\t\t* 5. 修改学生成绩 *\n"); printf("\t\t* 0. 退出管理系统 *\n"); printf("\t\t* 欢迎使用! *\n"); printf("\t\t=======================================================\n"); printf("\t\t输入你的选项:"); scanf("%d",&q); switch(q) { case 1: first(); printf("按任意键回菜单"); getchar(); system("cls");//表示转移号 break; case 2: secend(); getchar(); printf("按任意键回菜单"); getchar(); system("cls"); break; case 3: third(); getchar(); printf("\n请按任意键返回主菜单\n"); getchar(); system("cls"); break; case 4: fourth(); getchar(); printf("\n按任意键返回主菜单\n"); getchar(); system("cls"); break; case 5: fifth(); getchar(); printf("\n按任意键回主菜单\n"); getchar(); system("cls"); break; } }while(q); return 0; } void first() { thefirst: system("cls"); printf("********************************输入学生信息*********************************"); printf("\n\n"); int cw,temp,hh; char op; stu_number++; printf("\n>>>>>>>>请输入姓名: "); scanf("%s",all_stu[stu_number].stu_name); printf("\n>>>>>>>>请输入学号: "); scanf("%d",&temp); all_stu[stu_number].stu_id=temp; getchar();//接收一个空格 printf("\n>>>>>>>>请输入高等数学成绩(小于等于100):"); scanf("%lf",&all_stu[stu_number].stu_math); if (all_stu[stu_number].stu_math> 100) { printf("输入有误,请输入正确的成绩信息,请按(y)重新输入: "); getchar(); cw = getchar(); if (cw =='y'|| cw =='y') goto thefirst; } printf("\n>>>>>>>>请输入大学英语成绩(小于等于100):"); scanf("%lf", &all_stu[stu_number].stu_english); if (all_stu[stu_number].stu_english> 100) { printf("输入有误,请输入正确的成绩信息,请按(y)重新输入: "); getchar();//接收y cw = getchar(); if (cw == 'y' || cw == 'y') goto thefirst; } thefirstone: printf("\n是否继续输入,如是请按(y),否请按(n): "); getchar(); scanf("%c", &op); if (op == 'y' || op == 'y') goto thefirst; if (op == 'n' || op == 'n') goto thefirstend; else goto thefirstone; getchar(); thefirstend:; getchar();//输入任意数结束 } void secend() { thesecend: system("cls"); printf("\n\n**************************查找学生成绩*************************"); int data,cw,j,flag=0; char op; printf("\n>>>>>>>>请输入要查找学生的学号:"); scanf("%d",&data); for (j=1;j<=stu_number;j++) { if(data==all_stu[j].stu_id) { flag=1; break; } } if (flag==0) { printf("未查找到此学号,重新输入请按(y),如不需要请按(n)将返回主菜单: "); getchar(); cw=getchar(); if (cw=='y'||cw=='y') goto thesecend; if (cw == 'n' || cw == 'n') goto thesecendend; } else { for(j=1;j<=stu_number;j++){ printf("\n***********************************************"); printf("\n*姓名___: "); printf("%s",all_stu[j].stu_name); printf("\n*学号___: "); printf("%d",all_stu[j].stu_id); printf("\n*高数_: "); printf("%.2lf", all_stu[j].stu_math); printf("\n*大学英语_: "); printf("%.2lf", all_stu[j].stu_english); printf("\n************************************************"); } } thesecendone: getchar(); printf("\n输入错误,是否继续查阅?\n需要按(y),如不需要按(n),将返回主界面:"); scanf("%c",&op); if (op =='y' || op =='y') goto thesecend; if (op =='n' || op =='n') goto thesecendend; else goto thesecendone; thesecendend:; } void third() { thethird: system("cls"); printf("\n\n*********************显示学生信息******************************"); int n=1; printf("\n\n>>>姓名"); printf("\t学号"); printf("\t高等数学"); printf("\t大学英语"); //for (n=0;n<stu_number;n++); do { printf("\n>>%s", all_stu[n].stu_name); printf("\t%d", all_stu[n].stu_id); printf("\t%.2lf", all_stu[n].stu_math); printf("\t%.2lf", all_stu[n].stu_english); n++; } while (n<=stu_number); } void fourth() { thefourth: system("cls"); printf("\n\n\n\n********************删除学生成绩**********************"); int num,cw,cx,ai,i=0; char op; printf("\n>>>>>>>>请输入要查找学生的学号: "); scanf("%d",&num); for (ai=1;ai<=stu_number;ai++) { if (num==all_stu[ai].stu_id) { i=1; break; } } if (i==0) { printf("未查找到要删除的学生信息,是否要重新输入,如需要重新输入请按(y),如不需要请按(n)将返回主菜单: "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefourth;//回到开始 if (cw == 'n' || cw == 'n') goto thefourthend;//回到结尾 } else { stu_number--;//人数减一 for (;ai<stu_number;ai--) { all_stu[ai] = all_stu[ai+1];//后面的数据往前推 } } printf("\n\n此学号的学生成绩信息已删除"); getchar(); thefourthone: getchar(); printf("\n删除的成绩信息以删除,是否继续?\n需要请(y),如不需要请(n),将返回主界面: "); scanf("%c", &op); if (op == 'y' || op == 'y') goto thefourth; if (op == 'n' || op == 'n') goto thefourthend; else goto thefourthone; thefourthend:; } void fifth()//修改成绩 { thefifth: system("cls"); printf("**************************修改学生成绩*************************"); printf("\n\n"); int num,cw,cx,ai,i = 0, cy, temp; char op; printf("\n>>>>>>>>请输入要查找学生的学号: "); scanf("%d", &num); for (ai=1; ai<=stu_number; ai++) { if (num ==all_stu[ai].stu_id) { i = 1; break; } } if (i == 0) { printf("未查找到要修改的学生信息,重新输入按y,返回主菜单按n "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifth; if (cw == 'n' || cw == 'n') goto thefifthend; } else { printf("***************************************************************************"); printf("\n*姓名___: "); printf("%s", all_stu[ai].stu_name); printf("\n*学号___: "); printf("%d", all_stu[ai].stu_id); printf("\n*高数成绩: "); printf("%.2lf", all_stu[ai].stu_math); printf("\n*大学英语成绩: "); printf("%.2lf",all_stu[ai].stu_english); printf("\n***************************************************************************"); } getchar(); printf("\n\n是否确认修改此学生成绩信息?(注:修改后将不可还原)如需修改请按y,如不需修改学生信息请安n返回主菜单: "); thefifthone: cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifthtwo; if (cw == 'n' || cw == 'n') goto thefifthend; else goto thefifthone; thefifthtwo: system("cls"); printf("\n>>>>>>>>请输入姓名: "); scanf("%s", all_stu[ai].stu_name); printf("\n>>>>>>>>请输入学号: "); scanf("%d",&temp); all_stu[ai].stu_id = temp; getchar(); for (cy = 0; cy < ai; cy++) { if (all_stu[ai].stu_id == all_stu[cy].stu_id) { printf("学号输入错误,如需重新输入请按(y)退出请按(n)"); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifthtwo; else goto thefifthend; } } printf("\n>>>>>>>>请输入第一门成绩(小于100): "); scanf("%lf", &all_stu[ai].stu_math); if (all_stu[ai].stu_math > 100) { printf("输入有误,请按(y)重新输入: "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifthtwo; } printf("\n>>>>>>>>请输入第二门成绩(小于100): "); scanf("%lf", &all_stu[ai].stu_english); if (all_stu[ai].stu_english > 100) { printf("输入有误,请按(y)重新输入: "); getchar(); cw = getchar(); if (cw == 'y' || cw == 'y') goto thefifthtwo; } printf("\n\n"); printf("\n ok 此学生成绩信息已修改完成,感谢您的使用。"); thefifthfanhui: getchar(); printf("\n成绩信息已修改,是否继续?\n需要请按y,如不需要请按y,将返回主菜单: "); scanf("%c", &op); if (op == 'y' || op == 'y') goto thefifth; if (op == 'n' || op == 'n') goto thefifthend; else goto thefifthfanhui; thefifthend:; }

by:一个刚刚学习c语言的大学生~~

到此这篇关于c语言不用链表完成学生管理系统(完整代码)的文章就介绍到这了,更多相关c语言学生管理系统内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/Waterpaddler/article/details/115678620

如果您对该产品感兴趣,请填写办理(客服微信:xiaoxiongyidong)

为您推荐:

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。