本文实例为大家分享了C语言实现学生信息管理系统的具体代码,供大家参考,具体内容如下
下面是我自己用写的学生信息管理系统,为了增加数据的利用率,分为学生端和教师端,同时实现账号密码登录,以文件的形式将其存入。
代码如下
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
|
#include <stdio.h>
#include <string.h>
#include <string>
#include<Windows.h>
#define USER "TOM" // 事先定义用户名,用于登录页面,验证身份。
#define PW "123456789" // 事先定义密码 ,作用同上。
void Level_menu(); //主菜单的声明--选择学生端还是老师端。
void Level_2_menu(); //二级菜单——具体功能分化
void Student_add_Level_3_menu(); // 增添学生信息菜单功能分化
void Student_Insert(); //添加单个学生信息
void Student_Insert1(); /*为上面批量输入设置的函数,其代码与上面的
单个输入相似,删减了一部分*/
void Student_Tongji_menu(); //统计菜单部分
void Student_Tongji_menu2(); //统计二级菜单
void Student_Tongji_menu3(); //统计
void IO_ReadInfo(); /*将学生信息从文件(student database.txt)中读出*/
void IO_WriteInfo(); /*将学生信息写入文件(Database.txt)*/
void student_Delete_menu(); /*删除学生信息菜单*/
void student_menu1(); /*学生查询课程信息菜单*/
void student_Kecheng_menu2();
void Student_From_high_to_low1(); /*按综合测评从高到低排序*/
void jiangxue_menu(); /*奖学金评定办法*/
void Student_Display2(); /*显示学生信息2在奖学金评定时使用*/
/*定义学生结构体*/
struct Student
{
char ID[20]; //学号
char Name[20]; //姓名
char sushe[6]; //宿舍房间号
float mathA1; //高等数学成绩
float EnglishA1; //大学英语成绩
float software; //软件技术导论
float china_history; //中国近代史纲要
float junshi; //军事教育
float xinli; //心理健康辅导
float sports; //体育*/
float C_Mark; //C语言程学设计成绩
float pingjun; //总学分
float Banzhuren; //班主任评分
float Cepingfen; //测评分
};
/*声明学生数组及学生数量*/
struct Student students[1000];
int num=0;
int Num;
/*通过学号返回数组下标*/
int Student_SearchByIndex( char id[])
{
int i;
for (i=0;i<num;i++)
{
if ( strcmp (students[i].ID,id)==0)
{
return i;
}
}
return -1;
}
/*通过姓名返回数组下标*/
int Student_SearchByName( char name[])
{
int i;
for (i=0;i<num;i++)
{
if ( strcmp (students[i].Name,name)==0)
{
return i;
}
}
return -1;
}
/*通过宿舍成员返回数组下标*/
void Student_SearchBySushe()
{
system ( "cls" );
system ( "color f0" );
int i;
char Sushe[6] ;
printf ( "请输入你想要查询的宿舍房间号: " );
scanf ( "%s" ,&Sushe);
printf ( "%10s%10s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s\n" , "学号" , "姓名" , "宿舍号" , "高等数学" , "大学英语" , "软件技术导论" , "中国近代史" , "军事教育" , "心理健康教育" , "大学体育" , "C语言成绩" , "总学分" , "班主任评分" , "测评分" );
printf ( "------------------------------------------------------------------------------------------------------------------------\n" );
for (i=0;i<num;i++)
{
if ( strcmp (students[i].sushe,Sushe)==0)
{
printf ( "%10s%10s%5s %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n" ,students[i].ID,students[i].Name,students[i].sushe,students[i].mathA1,students[i].EnglishA1,students[i].software,students[i].china_history,students[i].junshi,students[i].xinli,students[i].sports,students[i].C_Mark,students[i].pingjun,students[i].Banzhuren,students[i].Cepingfen);
}
}
printf ( "数据加载完毕!" );
Student_Tongji_menu2();
}
/*显示单条学生记录*/
void Student_DisplaySingle( int index)
{
printf ( "%10s%10s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s\n" , "学号" , "姓名" , "宿舍号" , "高等数学" , "大学英语" , "软件技术导论" , "中国近代史" , "军事教育" , "心理健康教育" , "大学体育" , "C语言成绩" , "品行分" );
printf ( "------------------------------------------------------------------------------------------------------------------------\n" );
printf ( "%10s%10s%5s %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n" ,students[index].ID,students[index].Name,students[index].sushe,students[index].mathA1,students[index].EnglishA1,students[index].software,students[index].china_history,students[index].junshi,students[index].xinli,students[index].sports,students[index].C_Mark,students[index].pingjun);
}
/*增加单条学生记录*/
void Student_Insert()
{
system ( "cls" );
system ( "color f0" );
float a1,a2,a3,a4,a5,a6,a7,a8;
float j=0;
while (1)
{
printf ( "请输入学号:" );
scanf ( "%s" ,&students[num].ID);
getchar ();
printf ( "请输入姓名:" );
scanf ( "%s" ,&students[num].Name);
getchar ();
printf ( "请输入宿舍号:" );
scanf ( "%s" ,&students[num].sushe);
getchar ();
printf ( "请输入高等数学成绩:" );
scanf ( "%f" ,&students[num].mathA1);
getchar ();
if (59<students[num].mathA1 && students[num].mathA1<100)
a8= 1.5;
else
a8=0;
printf ( "请输入大学英语成绩:" );
scanf ( "%f" ,&students[num].EnglishA1);
getchar ();
if (59<students[num].EnglishA1 && students[num].EnglishA1<100)
a1= 2;
else
a1=0;
printf ( "请输入软件技术导论成绩:" );
scanf ( "%f" ,&students[num].software);
getchar ();
if (59<students[num].software && students[num].software<100)
a2= 1.5;
else
a2=0;
printf ( "请输入中国近代史纲要成绩:" );
scanf ( "%f" ,&students[num].china_history);
getchar ();
if (59<students[num].china_history && students[num].china_history<100)
a3= 2.5;
else
a3=0;
printf ( "请输入军事教育:" );
scanf ( "%f" ,&students[num].junshi);
getchar ();
if (59<students[num].junshi && students[num].junshi<100)
a4= 2;
else
{
a4=0;
}
printf ( "请输入心理健康教育成绩:" );
scanf ( "%f" ,&students[num].xinli);
getchar ();
if (59<students[num].xinli && students[num].xinli<100)
a5= 1.5;
else
a5=0;
printf ( "请输入体育成绩:" );
scanf ( "%f" ,&students[num].sports);
getchar ();
if (59<students[num].sports && students[num].sports<100)
a6= 2;
else
a6=0;
printf ( "请输入C语言成绩:" );
scanf ( "%f" ,&students[num].C_Mark);
getchar ();
if (59<students[num].C_Mark && students[num].C_Mark<100)
a7= 3.5;
else
a7=0;
printf ( "请输入班主任评分:" );
scanf ( "%f" ,&students[num].Banzhuren);
getchar ();
students[num].pingjun=a1+a2+a3+a4+a5+a6+a7+a8; //总学分
j=(students[num].pingjun*0.4)+(students[num].Banzhuren*0.6);
students[num].Cepingfen=j;
num++;
printf ( "是否继续?(Y/N),继续请按任意键,否则输入N:" );
if ( getchar ()== 'N' )
{
Num=num;
break ;
}
}
}
/*批量添加学生记录*/
void Student_many1()
{
{
system ( "cls" );
system ( "color f0" );
int i,j;
printf ( "请输入你将要添加的人员数: " );
scanf ( "%d" ,&j);
for (i=0;i<j;i++)
{
Student_Insert1();
}
printf ( "成员添加完毕,是否跳转至上一级菜单?\n" );
printf ( "是?,请按任意键,确认输入: \n" );
if ( getchar ()== 'Y' )
{
Student_add_Level_3_menu();
}
}
}
/*为上面批量输入设置的函数,其代码与上面的
单个输入相似,删减了一部分*/
void Student_Insert1()
{
{
printf ( "请输入学号:" );
scanf ( "%s" ,&students[num].ID);
getchar ();
printf ( "请输入姓名:" );
scanf ( "%s" ,&students[num].Name);
getchar ();
printf ( "请输入宿舍号:" );
scanf ( "%s" ,&students[num].sushe);
getchar ();
printf ( "请输入高等数学成绩:" );
scanf ( "%f" ,&students[num].mathA1);
getchar ();
printf ( "请输入大学英语成绩:" );
scanf ( "%f" ,&students[num].EnglishA1);
getchar ();
printf ( "请输入软件技术导论成绩:" );
scanf ( "%f" ,&students[num].software);
getchar ();
printf ( "请输入中国近代史纲要成绩:" );
scanf ( "%f" ,&students[num].china_history);
getchar ();
printf ( "请输入军事教育:" );
scanf ( "%f" ,&students[num].junshi);
getchar ();
printf ( "请输入心理健康教育成绩:" );
scanf ( "%f" ,&students[num].xinli);
getchar ();
printf ( "请输入体育成绩:" );
scanf ( "%f" ,&students[num].sports);
getchar ();
printf ( "请输入C语言成绩:" );
scanf ( "%f" ,&students[num].C_Mark);
getchar ();
printf ( "请输入班主任评分:" );
scanf ( "%f" ,&students[num].Banzhuren);
getchar ();
if (54<students[num].C_Mark && students[num].C_Mark< 60) //把55~59分之间的成绩都加上5分
{
students[num].C_Mark += 5;
}
num++;
}
}
/*修改学生信息*/
void Student_Modify()
{
system ( "cls" );
system ( "color f0" );
float a1,a2,a3,a4,a5,a6,a7,a8;
float j=0;
while (1)
{
char id[20];
int index;
printf ( "请输入要修改的学生的学号:" );
scanf ( "%s" ,&id);
getchar ();
index=Student_SearchByIndex(id);
if (index==-1)
{
printf ( "该学生不存在!\n" );
}
else
{
printf ( "你要修改的学生信息为:\n" );
Student_DisplaySingle(index);
printf ( "-- 请输入新值--\n" );
/*printf("请输入学号:");
scanf("%s",&students[index].ID);
getchar();
printf("请输入姓名:");
scanf("%s",&students[index].Name);
getchar();
printf("请输入宿舍号:");
scanf("%s",&students[index].sushe);
getchar();
printf("请输入高等数学成绩:");
scanf("%f",&students[index].mathA1);
getchar();
printf("请输入大学英语成绩:");
scanf("%f",&students[index].EnglishA1);
getchar();
printf("请输入软件技术导论成绩:");
scanf("%f",&students[index].software);
getchar();
printf("请输入中国近代史纲要成绩:");
scanf("%f",&students[index].china_history);
getchar();
printf("请输入军事教育:");
scanf("%f",&students[index].junshi);
getchar();
printf("请输入心理健康教育成绩:");
scanf("%f",&students[index].xinli);
getchar();
printf("请输入体育成绩:");
scanf("%f",&students[index].sports);
getchar();
printf("请输入C语言成绩:");
scanf("%f",&students[index].C_Mark);
getchar();
printf("请输入班主任评分:");
scanf("%f",&students[num].Banzhuren);
getchar();*/
printf ( "请输入学号:" );
scanf ( "%s" ,&students[index].ID);
getchar ();
printf ( "请输入姓名:" );
scanf ( "%s" ,&students[index].Name);
getchar ();
printf ( "请输入宿舍号:" );
scanf ( "%s" ,&students[index].sushe);
getchar ();
printf ( "请输入高等数学成绩:" );
scanf ( "%f" ,&students[index].mathA1);
getchar ();
if (59<students[index].mathA1 && students[index].mathA1<100)
a8= 1.5;
else
a8=0;
printf ( "请输入大学英语成绩:" );
scanf ( "%f" ,&students[index].EnglishA1);
getchar ();
if (59<students[index].EnglishA1 && students[index].EnglishA1<100)
a1= 2;
else
a1=0;
printf ( "请输入软件技术导论成绩:" );
scanf ( "%f" ,&students[index].software);
getchar ();
if (59<students[index].software && students[index].software<100)
a2= 1.5;
else
a2=0;
printf ( "请输入中国近代史纲要成绩:" );
scanf ( "%f" ,&students[index].china_history);
getchar ();
if (59<students[index].china_history && students[index].china_history<100)
a3= 2.5;
else
a3=0;
printf ( "请输入军事教育:" );
scanf ( "%f" ,&students[index].junshi);
getchar ();
if (59<students[index].junshi && students[index].junshi<100)
a4= 2;
else
{
a4=0;
}
printf ( "请输入心理健康教育成绩:" );
scanf ( "%f" ,&students[index].xinli);
getchar ();
if (59<students[index].xinli && students[index].xinli<100)
a5= 1.5;
else
a5=0;
printf ( "请输入体育成绩:" );
scanf ( "%f" ,&students[index].sports);
getchar ();
if (59<students[index].sports && students[index].sports<100)
a6= 2;
else
a6=0;
printf ( "请输入C语言成绩:" );
scanf ( "%f" ,&students[index].C_Mark);
getchar ();
if (59<students[index].C_Mark && students[index].C_Mark<100)
a7= 3.5;
else
a7=0;
printf ( "请输入班主任评分:" );
scanf ( "%f" ,&students[index].Banzhuren);
getchar ();
students[index].pingjun=a1+a2+a3+a4+a5+a6+a7+a8; //总学分
j=(students[index].pingjun*0.4)+(students[index].Banzhuren*0.6);
students[index].Cepingfen=j;
}
printf ( "是否继续?(Y/N),继续请按任意键,否则输入N:" );
if ( getchar ()== 'N' )
{
break ;
}
}
}
/*按学号删除学生信息*/
void Student_Delete()
{
system ( "cls" );
system ( "color f0" );
IO_ReadInfo();
int i;
while (1)
{
char id[20];
int index;
printf ( "请输入要删除的学生的学号:" );
scanf ( "%s" ,&id);
getchar ();
index=Student_SearchByIndex(id);
if (index==-1)
{
printf ( "学生不存在!\n" );
}
else
{
printf ( "你要删除的学生信息为:\n" );
Student_DisplaySingle(index);
printf ( "%d" ,index);
printf ( "%d" ,num);
{
for (i=index;i<num-1;i++)
{
students[i]=students[i+1]; //把后边的对象都向前移动
}
num--;
}
printf ( "已删除\n" );
IO_WriteInfo();
}
printf ( "是否继续删除?(Y/N),继续请按任意键,否则输入N:" );
if ( getchar ()== 'N' )
{
break ;
}
}
}
/*按姓名删除学生信息*/
void Student_Delete_1()
{
system ( "cls" );
system ( "color f0" );
IO_ReadInfo();
int i;
while (1)
{
char name[20];
int index;
printf ( "请输入要删除的学生的姓名: " );
scanf ( "%s" ,&name);
getchar ();
index=Student_SearchByName(name);
if (index==-1)
{
printf ( "学生不存在!\n" );
}
else
{
printf ( "你要删除的学生信息为:\n" );
Student_DisplaySingle(index);
{
for (i=index;i<num-1;i++)
{
students[i]=students[i+1]; //把后边的对象都向前移动
}
num--;
}
printf ( "已删除\n" );
IO_WriteInfo();
}
printf ( "是否继续删除?(Y/N),继续请按任意键,否则输入N:" );
if ( getchar ()== 'N' )
{
break ;
}
}
}
/*按姓名查询*/
void Student_Select_1()
{
while (1)
{
char name[20];
int index;
printf ( "请输入要查询的学生的姓名:" );
scanf ( "%s" ,&name);
getchar ();
index=Student_SearchByName(name);
if (index==-1)
{
printf ( "学生不存在!\n" );
}
else
{
printf ( "你要查询的学生信息为:\n" );
Student_DisplaySingle(index);
}
printf ( "是否继续?(Y/N),继续请按任意键,否则输入N:" );
if ( getchar ()== 'N' )
{
break ;
}
}
}
/*按学号查找*/
void Student_Select_2()
{
while (1)
{
char ID[20];
int index;
system ( "cls" );
system ( "color f0" );
printf ( "请输入要查询的学生的学号:" );
scanf ( "%s" ,&ID);
getchar ();
index=Student_SearchByIndex(ID);
if (index==-1)
{
printf ( "学生不存在!\n" );
}
else
{
printf ( "你要查询的学生信息为:\n" );
Student_DisplaySingle(index);
}
printf ( "是否继续?(Y/N),继续请按任意键,否则输入N:" );
if ( getchar ()== 'N' )
{
break ;
}
}
}
void Student_Search_menu()
{
int choice;
while (1)
{
system ( "cls" );
system ( "color f0" );
printf ( "\t\t\t\t\t\t1. 按姓名查询学生记录\n" );
printf ( "\t\t\t\t\t\t2. 按学号查询学生记录\n" );
printf ( "\t\t\t\t\t\t3. 返回上一级菜单\n" );
printf ( "\t\t\t\t\t\t4. 返回主菜单\n" );
printf ( "\t\t\t\t\t\t请选择(1-4):" );
scanf ( "%d" ,&choice);
getchar ();
switch (choice)
{
case 1:Student_Select_1();
break ;
case 2:Student_Select_2();
break ;
case 3:Level_2_menu();
break ;
case 4:Level_menu();
break ;
}
}
}
/*按C语言成绩从高到低排序*/
void Student_From_high_to_low()
{
int i,j;
struct Student tmp;
for (i=0;i<num;i++)
{
for (j=1;j<num-i;j++)
{
if (students[j-1].C_Mark<students[j].C_Mark)
{
tmp=students[j-1];
students[j-1]=students[j];
students[j]=tmp;
}
}
}
}
/*按C语言成绩从低到高排序*/
void Student_From_low_to_high()
{
int i,j;
struct Student tmp;
for (i=0;i<num;i++)
{
for (j=1;j<num-i;j++)
{
if (students[j-1].C_Mark>students[j].C_Mark)
{
tmp=students[j-1];
students[j-1]=students[j];
students[j]=tmp;
}
}
}
}
/*按综合测评从高到低排序*/
void Student_From_high_to_low1()
{
int i,j,k;
struct Student tmp;
for (i=0;i<num;i++)
{
for (j=1;j<num-i;j++)
{
if (students[j-1].Cepingfen<students[j].Cepingfen)
{
tmp=students[j-1];
students[j-1]=students[j];
students[j]=tmp;
}
}
}
/*system("cls");
system("color f0");
while(1)
{
int k;
printf("%10s%10s %8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s\n","学号","姓名","宿舍号"," 高等数学","大学英语","软件技术导论","中国近代史","军事教育","心理健康教育","大学体育","C语言成绩","品行分","班主任评分","测评分");
printf("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
for (k=0;k<num;k++)
{
if(59<students[k].mathA1&&students[k].mathA1<101&&59<students[k].EnglishA1&&students[k].EnglishA1<101&&59<students[k].software&&students[k].software<101&&59<students[k].china_history&&students[k].china_history<101&&59<students[k].junshi&&students[k].junshi<101&&59<students[k].xinli&&students[k].xinli<101&&59<students[k].sports&&students[k].sports<101&&59<students[k].C_Mark&&students[k].C_Mark<101);
{
printf("%10s%10s %8s %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n",students[k].ID,students[k].Name,students[k].sushe,students[k].mathA1,students[k].EnglishA1,students[k].software,students[k].china_history,students[k].junshi,students[k].xinli,students[k].sports,students[k].C_Mark,students[k].pingjun,students[k].Banzhuren,students[k].Cepingfen);
}
}
printf("数据加载完毕!");
jiangxue_menu();
Student_Tongji_menu3();
} */
}
/*奖学金评定办法*/
void jiangxue_menu()
{
float i=0,j=0,k=0;
int a,b,c;
i=num*0.1;
j=num*0.15;
k=num*0.2;
a=( int )i;
b=( int )j;
c=( int )k;
printf ( "一等奖获得人数为:%d\n" ,a);
printf ( "二等奖获奖人数为:%d\n" ,b);
printf ( "三等奖获奖人数为:%d\n" ,c);
}
//对奖学金及格的人员筛选出来
void jiangxue()
{
system ( "cls" );
system ( "color f0" );
while (1)
{
int k;
printf ( "%10s%10s %8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s\n" , "学号" , "姓名" , "宿舍号" , " 高等数学" , "大学英语" , "软件技术导论" , "中国近代史" , "军事教育" , "心理健康教育" , "大学体育" , "C语言成绩" , "品行分" , "班主任评分" , "测评分" );
printf ( "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" );
for (k=0;k<num;k++)
{
if (59<students[k].mathA1&&students[k].mathA1<101&&59<students[k].EnglishA1&&students[k].EnglishA1<101&&59<students[k].software&&students[k].software<101&&59<students[k].china_history&&students[k].china_history<101&&59<students[k].junshi&&students[k].junshi<101&&59<students[k].xinli&&students[k].xinli<101&&59<students[k].sports&&students[k].sports<101&&59<students[k].C_Mark&&students[k].C_Mark<101);
{
printf ( "%10s%10s %8s %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n" ,students[k].ID,students[k].Name,students[k].sushe,students[k].mathA1,students[k].EnglishA1,students[k].software,students[k].china_history,students[k].junshi,students[k].xinli,students[k].sports,students[k].C_Mark,students[k].pingjun,students[k].Banzhuren,students[k].Cepingfen);
}
}
printf ( "数据加载完毕!" );
jiangxue_menu();
Student_Tongji_menu3();
}
}
/*显示学生信息*/
void Student_Display()
{
system ( "cls" );
system ( "color f0" );
while (1)
{
int i;
printf ( "%10s%10s %8s%8s%8s%8s%8s%8s%8s%8s%8s%8s\n" , "学号" , "姓名" , "宿舍号" , " 高等数学" , "大学英语" , "软件技术导论" , "中国近代史" , "军事教育" , "心理健康教育" , "大学体育" , "C语言成绩" , "品行分" );
printf ( "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" );
for (i=0;i<num;i++)
{
printf ( "%10s%10s %8s %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n" ,students[i].ID,students[i].Name,students[i].sushe,students[i].mathA1,students[i].EnglishA1,students[i].software,students[i].china_history,students[i].junshi,students[i].xinli,students[i].sports,students[i].C_Mark,students[i].pingjun);
}
printf ( "是否继续?(Y/N),继续请按任意键,否则输入N:" );
if ( getchar ()== 'N' )
{
break ;
}
}
}
/*显示学生信息1*/
void Student_Display1()
{
system ( "cls" );
system ( "color f0" );
while (1)
{
int i;
printf ( "%10s%10s %8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s\n" , "学号" , "姓名" , "宿舍号" , " 高等数学" , "大学英语" , "软件技术导论" , "中国近代史" , "军事教育" , "心理健康教育" , "大学体育" , "C语言成绩" , "品行分" , "班主任评分" , "测评分" );
printf ( "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" );
for (i=0;i<num;i++)
{
printf ( "%10s%10s %8s %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n" ,students[i].ID,students[i].Name,students[i].sushe,students[i].mathA1,students[i].EnglishA1,students[i].software,students[i].china_history,students[i].junshi,students[i].xinli,students[i].sports,students[i].C_Mark,students[i].pingjun,students[i].Banzhuren,students[i].Cepingfen);
}
printf ( "数据加载完毕!" );
Student_Tongji_menu3();
}
}
/*显示学生信息2在奖学金评定时使用*/
void Student_Display2()
{
system ( "cls" );
system ( "color f0" );
while (1)
{
int i;
printf ( "%10s%10s %8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s%8s\n" , "学号" , "姓名" , "宿舍号" , " 高等数学" , "大学英语" , "软件技术导论" , "中国近代史" , "军事教育" , "心理健康教育" , "大学体育" , "C语言成绩" , "品行分" , "班主任评分" , "测评分" );
printf ( "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" );
for (i=0;i<num;i++)
{
printf ( "%10s%10s %8s %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n" ,students[i].ID,students[i].Name,students[i].sushe,students[i].mathA1,students[i].EnglishA1,students[i].software,students[i].china_history,students[i].junshi,students[i].xinli,students[i].sports,students[i].C_Mark,students[i].pingjun,students[i].Banzhuren,students[i].Cepingfen);
}
printf ( "数据加载完毕!" );
jiangxue_menu();
Student_Tongji_menu3();
}
}
/*将学生信息从文件(student database.txt)中读出*/
void IO_ReadInfo()
{
FILE *fp;
int i;
if ((fp= fopen ( "student database.txt" , "rb" ))==NULL)
{
printf ( "不能打开文件!\n" );
return ;
}
if ( fread (&num, sizeof ( int ),1,fp)!=1)
{
num=-1;
}
else
{
for (i=0;i<num;i++)
{
fread (&students[i], sizeof ( struct Student),1,fp);
}
}
fclose (fp);
}
/*将学生信息写入文件(Database.txt)*/
void IO_WriteInfo()
{
FILE *fp;
int i;
if ((fp= fopen ( "student database.txt" , "wb" ))==NULL)
{
printf ( "不能打开文件!\n" );
return ;
}
if ( fwrite (&num, sizeof ( int ),1,fp)!=1)
{
printf ( "写入文件错误!\n" );
}
for (i=0;i<num;i++)
{
if ( fwrite (&students[i], sizeof ( struct Student),1,fp)!=1)
{
printf ( "写入文件错误!\n" );
}
}
fclose (fp);
}
/*一级菜单*/
/*账号密码登录*/
void Level_1_menu( )
{ char account[20];
char password[30];
int i = 0;
int j = 3;
for (; i < 3; i++){
printf ( "\n\n\n\n\t\t\t\t\t\t *主菜单*\n" );
printf ( "\t\t\t\t\t\t******************\n" );
printf ( "\t\t\t\t\t\t*请输入您的账号:*\n" );
printf ( "\t\t\t\t\t\t******************\n" );
printf ( " 请输入:" );
scanf ( "%s" , account);
printf ( "\t\t\t\t\t\t******************\n" );
//scanf ("%s", account);
printf ( "\t\t\t\t\t\t******************\n" );
printf ( "\t\t\t\t\t\t*请输入您的密码:*\n" );
printf ( "\t\t\t\t\t\t******************\n" );
printf ( " 请输入:" );
scanf ( "%s" , password);
if ( strcmp (USER, account) == 0 && strcmp (PW, password) == 0){
printf ( "登录成功!\n" );
break ;
}
else {
j--;
printf ( "登录失败您还有%d次机会!\n" , j);
}
}
if (i == 3){
printf ( "登录失败,退出!" );
}
//system("pause");
system ( "cls" );
system ( "color f0" );
}
/*增加学生信息三级菜单模块*/
void Student_add_Level_3_menu()
{
int choice;
while (1)
{
system ( "cls" );
system ( "color f0" );
IO_ReadInfo(); //读取文件
printf ( "\t\t\t\t\t\t1. 单个添加学生信息\n" );
printf ( "\t\t\t\t\t\t2. 批量添加学生信息\n" );
printf ( "\t\t\t\t\t\t3. 返回上一级菜单\n" );
printf ( "\t\t\t\t\t\t4. 返回主菜单\n" );
printf ( "\t\t\t\t\t\t请选择(1-4):" );
scanf ( "%d" ,&choice);
getchar ();
switch (choice)
{
case 1:Student_Insert();
IO_WriteInfo(); //写入文件
break ;
case 2:Student_many1();
IO_WriteInfo(); //写入文件
break ;
case 3:Level_2_menu();
break ;
case 4:Level_menu();
break ;
}
IO_WriteInfo(); //写入文件
}
//Student_Insert();
}
/*二级菜单*/
/*主菜单*/
void Level_2_menu( )
{
int choice;
while (1)
{
/*二级菜单*/
/*主菜单*/
system ( "cls" );
system ( "color f0" );
IO_ReadInfo(); //读取文件
printf ( "\n\t\t\t\t\t\t------ 学生成绩管理系统------\n" );
printf ( "\t\t\t\t\t\t1. 增加学生记录\n" );
printf ( "\t\t\t\t\t\t2. 修改学生记录\n" );
printf ( "\t\t\t\t\t\t3. 删除学生记录\n" );
printf ( "\t\t\t\t\t\t4. 查询学生记录\n" );
printf ( "\t\t\t\t\t\t5. 统计学生记录\n" );
printf ( "\t\t\t\t\t\t6. 退出\n" );
printf ( "\t\t\t\t\t\t请选择(1-6):" );
scanf ( "%d" ,&choice);
getchar ();
switch (choice)
{
case 1:
Student_add_Level_3_menu();
break ;
case 2:
Student_Modify();
break ;
case 3:
student_Delete_menu();
break ;
case 4:
Student_Search_menu();
break ;
case 5:
Student_Tongji_menu();
break ;
case 6:
Level_menu();
break ;
}
IO_WriteInfo();
}
}
/*学生端成绩查询模块*/
void student_Delete_menu()
{
int choice;
while (1)
{
system ( "cls" );
system ( "color f0" );
IO_ReadInfo(); //读取文件
printf ( "\n\n\n\n\t\t\t\t\t\t************************\n" );
printf ( "\t\t\t\t\t\t* 删除学生信息菜单******\n" );
printf ( "\t\t\t\t\t\t************************\n" );
printf ( "\t\t\t\t\t\t*1、按姓名删除信息 *\n" );
printf ( "\t\t\t\t\t\t*2、按学号删除信息 *\n" );
printf ( "\t\t\t\t\t\t*3、返回上一级功能菜单 *\n" );
printf ( "\t\t\t\t\t\t*4、返回主菜单 *\n" );
printf ( "\t\t\t\t\t\t************************\n" );
printf ( "\t\t\t\t\t\t************************\n" );
printf ( " 请选择(1-4):" );
scanf ( "%d" ,&choice);
switch (choice)
{
case 1:
system ( "cls" );
system ( "color f0" );
Student_Delete_1();
break ;
case 2:
system ( "cls" );
system ( "color f0" );
Student_Delete();
break ;
case 3:
Level_2_menu();
break ;
case 4:
Level_menu();
break ;
}
IO_WriteInfo();
}
}
/*学生端成绩查询模块*/
void student_menu()
{
int choice;
while (1)
{
system ( "cls" );
system ( "color f0" );
IO_ReadInfo(); //读取文件
printf ( "\n\n\n\n\t\t\t\t\t\t*******************\n" );
printf ( "\t\t\t\t\t\t* 学生菜单 *\n" );
printf ( "\t\t\t\t\t\t*******************\n" );
printf ( "\t\t\t\t\t\t*1、按姓名查询成绩*\n" );
printf ( "\t\t\t\t\t\t*2、按学号查询成绩*\n" );
printf ( "\t\t\t\t\t\t*3、查询课程信息 *\n" );
printf ( "\t\t\t\t\t\t*4、退出 *\n" );
printf ( "\t\t\t\t\t\t*******************\n" );
printf ( "\t\t\t\t\t\t*******************\n" );
printf ( " 请选择(1-3):" );
scanf ( "%d" ,&choice);
switch (choice)
{
case 1:
system ( "cls" );
system ( "color f0" );
Student_Select_1();
break ;
case 2:
Student_Select_2();
break ;
case 3:
student_menu1();
break ;
case 4:
Level_menu();
break ;
}
IO_WriteInfo();
}
}
void student_Kecheng_menu1()
{ printf ( "\n\n\n\n\t\t\t\t\t\t************************************************\n" );
printf ( "\t\t\t\t\t\t* 课程代号 课程名称 学分 必修/选修*\n" );
printf ( "\t\t\t\t\t\t*B27020100 中国近现代史纲要 2.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B10060111 大学英语A1 4.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B14010101 大学体育1 2.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B06010111 高等数学A1 5.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B08050101 软件技术导论 2.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B08010100 C语言程序设计 5.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B08010201 C语言程序设计实训1 2.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B08056601 创新与指导实践1 1.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B21991100 军事教育 2.0 选修 *\n" );
printf ( "\t\t\t\t\t\t**************************************************\n" );
printf ( "\t\t\t\t\t\t**************************************************\n" );
printf ( "\t\t\t\t\t\t1. 返回上一级菜单\n" );
printf ( "\t\t\t\t\t\t2. 返回主菜单\n" );
printf ( "\t\t\t\t\t\t请选择(1-2):" );
int choice;
scanf ( "%d" ,&choice);
while (1)
switch (choice)
{
case 1:student_menu1();
break ;
case 2:Level_menu();
break ;
}
//写入文件
}
void student_Kecheng_menu2()
{ printf ( "\n\n\n\n\t\t\t\t\t\t************************************************\n" );
printf ( "\t\t\t\t\t\t* 课程代号 课程名称 学分 必修/选修*\n" );
printf ( "\t\t\t\t\t\t*B27010100 思想道德修养 3.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B10060112 大学英语A2 4.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B14010102 大学体育2 2.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B06010112 高等数学A2 5.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B08052200 数字逻辑设计 2.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B06050131 大学物理C1 2.5 必修 *\n" );
printf ( "\t\t\t\t\t\t*B06020100 离散数学 4.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B08056601 创新与指导实践2 1.0 必修 *\n" );
printf ( "\t\t\t\t\t\t*B21991100 C语言程序设计实践2 2.0 选修 *\n" );
printf ( "\t\t\t\t\t\t**************************************************\n" );
printf ( "\t\t\t\t\t\t**************************************************\n" );
printf ( "\t\t\t\t\t\t1. 返回上一级菜单\n" );
printf ( "\t\t\t\t\t\t2. 返回主菜单\n" );
printf ( "\t\t\t\t\t\t请选择(1-2):" );
int choice;
scanf ( "%d" ,&choice);
while (1)
switch (choice)
{
case 1:student_menu1();
break ;
case 2:Level_menu();
break ;
}
//写入文件
}
/*学生端学生课程查询模块*/
void student_menu1()
{
int choice;
while (1)
{
system ( "cls" );
system ( "color f0" );
IO_ReadInfo(); //读取文件
printf ( "\n\n\n\n\t\t\t\t\t\t*******************\n" );
printf ( "\t\t\t\t\t\t* 课程信息 *\n" );
printf ( "\t\t\t\t\t\t*******************\n" );
printf ( "\t\t\t\t\t\t*1、第一学期 *\n" );
printf ( "\t\t\t\t\t\t*2、第二学期 *\n" );
printf ( "\t\t\t\t\t\t*3、第三学期 *\n" );
printf ( "\t\t\t\t\t\t*4、第四学期 *\n" );
printf ( "\t\t\t\t\t\t*5、第五学期 *\n" );
printf ( "\t\t\t\t\t\t*6、第六学期 *\n" );
printf ( "\t\t\t\t\t\t*7、第七学期 *\n" );
printf ( "\t\t\t\t\t\t*8、退出 *\n" );
printf ( "\t\t\t\t\t\t*******************\n" );
printf ( "\t\t\t\t\t\t*******************\n" );
printf ( " 请选择(1-3):" );
scanf ( "%d" ,&choice);
switch (choice)
{
case 1:
system ( "cls" );
system ( "color f0" );
student_Kecheng_menu1();
break ;
case 2:
system ( "cls" );
system ( "color f0" );
student_Kecheng_menu2();
break ;
case 3:
break ;
case 4:
break ;
case 5:
break ;
case 6:
break ;
case 7:
break ;
case 8:
Level_menu();
break ;
}
IO_WriteInfo();
}
}
/*统计菜单模块*/
void Student_Tongji_menu()
{
int choice;
while (1)
{
system ( "cls" );
system ( "color f0" );
IO_ReadInfo(); //读取文件
printf ( "\n\n\n\n\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t* 学生统计菜单 *\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t*1、按C语言成绩从高到低排序 *\n" );
printf ( "\t\t\t\t\t\t*2、按C语言成绩从低到高排序 *\n" );
printf ( "\t\t\t\t\t\t*3、按宿舍成员进行统计 *\n" );
printf ( "\t\t\t\t\t\t*4、奖学金评定 *\n" );
printf ( "\t\t\t\t\t\t*5、返回功能菜单 *\n" );
printf ( "\t\t\t\t\t\t*6、返回主菜单 *\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( " 请选择(1-5):" );
scanf ( "%d" ,&choice);
switch (choice)
{
case 1:
Student_From_high_to_low();
Student_Display1();
break ;
case 2:
Student_From_low_to_high();
Student_Display1();
break ;
case 3:
Student_SearchBySushe();
break ;
case 4:
Student_From_high_to_low1();
Student_Display2();
break ;
case 5:
Level_2_menu( );
break ;
case 6:
Level_menu();
break ;
}
IO_WriteInfo();
}
}
/*统计菜单模块*/
void Student_Tongji_menu2()
{
int choice;
while (1)
{
IO_ReadInfo(); //读取文件
printf ( "\n\n\n\n\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t* 你目前在学生宿舍统计页面! *\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t*1、返回上一级统计菜单 *\n" );
printf ( "\t\t\t\t\t\t*2、返回功能选择菜单 *\n" );
printf ( "\t\t\t\t\t\t*3、返回主菜单 *\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( " 请选择(1-3):" );
scanf ( "%d" ,&choice);
switch (choice)
{
case 1:
system ( "cls" );
system ( "color f0" );
Student_Tongji_menu();
case 2:
system ( "cls" );
system ( "color f0" );
Level_2_menu( );
case 3:
system ( "cls" );
system ( "color f0" );
Level_menu();
}
}
}
/*统计菜单模块*/
void Student_Tongji_menu3()
{
int choice;
while (1)
{
IO_ReadInfo(); //读取文件
printf ( "\n\n\n\n\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t* 你目前按C语言成绩统计页面!*\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t*1、返回上一级统计菜单 *\n" );
printf ( "\t\t\t\t\t\t*2、返回功能选择菜单 *\n" );
printf ( "\t\t\t\t\t\t*3、返回主菜单 *\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( "\t\t\t\t\t\t******************************\n" );
printf ( " 请选择(1-3):" );
scanf ( "%d" ,&choice);
switch (choice)
{
case 1:
system ( "cls" );
system ( "color f0" );
Student_Tongji_menu();
case 2:
system ( "cls" );
system ( "color f0" );
Level_2_menu( );
case 3:
system ( "cls" );
system ( "color f0" );
Level_menu();
}
}
}
/*第一级主菜单学生or老师的判断*/
void Level_menu()
{ int choice;
while (1)
{
system ( "cls" );
system ( "color f0" );
printf ( "\n\n\n\n\n\n\n\t\t\t\t\t\t******************\n" );
printf ( "\t\t\t\t\t\t*1、教师端 *\n" );
printf ( "\t\t\t\t\t\t*2、学生端 *\n" );
printf ( "\t\t\t\t\t\t*3、退出 *\n" );
printf ( "\t\t\t\t\t\t******************\n" );
printf ( " 请选择(1-3):" );
scanf ( "%d" ,&choice);
switch (choice)
{
case 1:
system ( "cls" );
system ( "color f0" );
Level_1_menu(); //一级菜单,密码登录。
IO_ReadInfo(); //读取文件
Level_2_menu(); //二级菜单-主菜单
IO_WriteInfo();
break ;
case 2:
student_menu();
break ;
case 3:
exit (0);
break ;
}
}
}
/***********主程序*********/
main()
{
Level_menu();
}
|
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/CM666_/article/details/107301047