C语言课程设计源代码

由于代码过于长,Flu不会维护本篇内容.
如同本篇博客一样,读者仅需遵守 CC BY-NC-SA 4.0 协议就可随意复制作为自己的课设使用:P

课设介绍

写一个教务系统,支持学生的增删查改,选课的增删查改,以及成绩的管理等.

Flu的代码

数据不放了,毕竟是一堆真名字和假成绩,自己看着输入做,很好做的.

数据格式.txt

写程序之前必须规定数据格式,每个人写自己的格式都不一样会很难办.

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
所有文件在./data/xxx.txt里面,规定格式进行IO操作。

首先要明确一点,data存放的是内部文件,不应该让用户看到,密码不用加密。这也就意味着内部文件全部是正确的,否则程序压根跑不了,链表建不起来就会爆炸。比如添加学生输114分不合法的应该直接指出,并且让用户重来。

注意使用ANSI编码否则会乱码。

另外,Flu采用重载所有文件的形式更新文件。
所有课程必须存在,不能重.

所有人密码除非自己设定默认1145141919810位数高还好记.

flag计算规则:
论文6等+9
竞赛,是+5,A+2,B+1,C=0

《--------------------------------------------------------------------------------》
teacher.txt 存放所有的老师信息。
%s %s %s %d %s %lld ("%s %s %d %s %lld")
姓名 性别 密码 工号 邮箱 电话号码
char char char int char long long
40 10 40 50 空间分配

%d
教几门课程
int

%s
课程名称
char
100

《--------------------------------------------------------------------------------》
cources.txt 存放所有课程信息
%s %s %d %f %d %d %s
名字 序列号 学时 学分 平时成绩占比 考试成绩占比 课程类型(必修,限选算绩点)
100 100 0-100int 20

%d
学生数

%s %d %f %f
名字 学号 平时 考试(最终成绩,绩点现算)
floatfloat float float

《--------------------------------------------------------------------------------》
student.txt存放所有的学生信息
%s %s %d %s
名字 性别 学号 密码
40 10 40
%d
选几门课
%s
直接连就行了,课程名
100
%d
竞赛得奖个数
%s %d %d
竞赛或论文名字 几等奖 代号(代号会影响绩点计算)
200

《--------------------------------------------------------------------------------》
unjing.txt 存放所有未审核的竞赛
%d %s %d %s %s
目标老师工号 认证学生名字 认证学生学号 认证奖项或论文名字加几等奖 学生自己写的备注
40 200 200

认证好直接加学生后面即可。

《--------------------------------------------------------------------------------》
jidian.txt 存放绩点计算规则
%d %f
多少分对应多少绩点
%d %f
%d %f
%d %f
%d %f...一共14

最后是竞赛计算
%f 一共有12个,前6个论文后6个竞赛。

《--------------------------------------------------------------------------------》
.csv所有人导出的规则
名字 排名 %d
学科 平时分 考试分 最终分
xxxxxx
奖项(不空行)
xxxxx %d等奖

《--------------------------------------------------------------------------------》
history.txt历史成员各种记录.

function.h 头文件,结构体,常量区(其实是全局变量了),函数的声明

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
#pragma once

#include<time.h>
#include<math.h>
#include<stdio.h>
#include<conio.h>
#include<errno.h>
#include<string.h>
#include<stdlib.h>
#include<windows.h>


#ifndef FUNCTION_H
#define FUNCTION_H
#define lowbit(x) x&-x
#define EPOCH 100
#define Len_Max 25
#define MAX_PWD 20
#define TEST_RATE 0.2
#define NUM_FEATURES 9
#define TRAIN_RATE 0.8
#define FEATURE_MAX 10
#define SAMPLE_MAX 1000
#define LEARNING_RATE 0.01
#define MAX_LINE_LENGTH 1024
#define DELIMITER ","
#define sl(x) Sleep(x)
#define si putchar('?')
#define cls system("cls")
#define asdf putchar(',')
#define space putchar(' ')
#define enter putchar('\n')

typedef struct STUDENT {
int id;//学号
char name[40];//姓名
float daily;//平时成绩
float text;//考试成绩
float final;//最终成绩
}Student;

typedef struct cource {
char number[50];//课程编号
char name[50];//课程名称
char type[50];//课程类型 限选,必修,选修,体育
char notice[300];//通知,老师可以发布通知
int notic;//有无通知的标记
int hours;//总学时
int top;//多少人学这个
float credit;//学分
int Daily;//平时成绩占比
int Text;//考试成绩占比
Student stu[100];//学生信息
cource* next;
}Course;

struct jing {//竞赛
char name[200];//竞赛名称
char flg;//竞赛种类 ABbC b是B*
char ff;//是不是计算机类竞赛,否则所得绩点折半(什么霸王条款)'0'不是 '1'Y
//float rp[10];//加绩点几等奖对应的
jing* next;
};

struct jingper {//个人竞赛经历
char name[200];//比赛名称
int num;//几等奖
int flg;//是论文还是比赛,这俩绩点计算不一样
jingper* next;
};

struct jingupper {//个人竞赛经历,自己填的,填完了申报
char ownername[40];//申请人姓名
int xh;//申请人学号
char name[200];//比赛名称
char ppin[100];//获奖序列号或者备注
int num;//几等奖
jingupper* next;
};

struct choose {
Course* tar;
choose* next;
};

struct stu {
int xh;//学号
char name[40];//姓名
float over;//最终绩点
char pas[40];//密码
char sex[10];//性别
char ff;//推免资格
int rank;//排名现算吧
int choo;//选课数
int ppri;//获奖数
choose* first;
jingper* prize;
stu* next;
};

struct teacher {
char name[40];//老师名字
int xh;//老师账号
char sex[10];
char email[50];//电子邮件
long long tel;//电话
char pas[40];//老师密码
int tn;//教几门课
choose* teach;//教课
jingupper* first;
teacher* next;
};

struct adm {
char name[100];
char pas[100];
unsigned long long xh;
adm* next;
};

typedef struct StudentGrade {
char Class[Len_Max];
int Grade[Len_Max];
}STG;
typedef struct {
double feature[FEATURE_MAX];
float label;
} MR_Sample;
typedef struct {
double w[FEATURE_MAX];
double b;
}MR_Model;
typedef struct {
double features[NUM_FEATURES]; // 有9个特征
double label;//标签为:学习状况
} LR_Sample;
typedef struct {
double weights[NUM_FEATURES]; // 权重
double bias; // 偏置
} LR_Model;


extern float jingji[12];//竞赛绩点
extern float jidian[14];//分数对应绩点
extern int point[14];//分数
extern time_t timer;
extern tm* info;
extern FILE* his;
extern Course* couhead;
extern stu* stuhead;
extern teacher* teahead;
extern jing* jinghead;
extern adm* admhead;
extern char Multipl_model[];
extern char Logical_model[];
extern int width;
extern int height;
extern int padding;
extern int length;
extern unsigned long long UPDATE;


// <------------------------------ - Function------------------------------------------>
//!!!!!!!!!!===================hisss历史文件选择和记录==============
FILE *gethis();
//!!!!!!!!!!=========================file===============================
teacher * buildtea(Course * head);
void getunp(teacher* head);
void updunp(teacher* head);
jing* jingsearch(int cnt, jing* head);
Course* coursearch1(Course* head, char arr[]);
Course* ReadCouInfor();
void updcou(Course* head);
void updtea(teacher* head);
void getjidian();
void updjidian();
jing* compet();
stu* ReadStuInfor(Course* hhead);
void updstu(stu* head);
void getadm();
void getupdate();
void updupdate();
void updcomp(jing *head);
//!!!!!!!!!=======================search==================================
teacher* teasearch1(int tar, teacher* head);//工号查找
teacher* teasearch2(int tar, teacher* head);//顺序查找
jing* jingsearch(int cnt, jing* head);//按照序号查找竞赛名字
Course* coursearch1(Course* head, char arr[]);//按课程名字查找课程
int courstusearch1(Course* nnode, int xh, float& res);//按学号课程中查找学生的位置,返回位号(int)和成绩
int courstusearch2(Course* nnode, char arr[], float& res);//按名字课程中查找学生的位置,返回位号(int)
Course* cousearch1(Course* head, int num);//按照序号返回指定课程指针
stu* stusearch1(char arr[], stu* head);//姓名查找
stu* stusearch2(int tar, stu* head);//学号查找
stu* stusearch3(int tar, stu* head);//顺序查找




//!!!!!!!!!!==================machine learn==================
void load_MRmodel(char* model_filename, MR_Model* model);//加载多元线性回归模型
void load_LRmodel(char* model_filename, LR_Model* model);//加载逻辑回归模型
double LR_predict(LR_Model* model, LR_Sample* LR_Sample);
double MR_predict(MR_Model* model, MR_Sample* MR_Sample);
void Gradeprdict();//成绩预测
void Learning_state();//学习状况判断
//!!!!!!!!!!=============sort cmp rank============================

char cmpc11(Student a, Student b);
char cmpc12(Student a, Student b);
char cmpc21(Student a, Student b);
char cmpc22(Student a, Student b);
char cmpc31(Student a, Student b);
char cmpc32(Student a, Student b);
char cmpc41(Student a, Student b);
char cmpc42(Student a, Student b);
void coursort(Course* nnode, char a(Student a, Student b));//一个课程排序,经典冒泡



char cmps10(stu* a, stu* b);//学号逆序,小的在上
char cmps21(stu* a, stu* b);//班号排序,一个班的按成绩从大往小排
char cmps22(stu* a, stu* b);//班号排序,一个班的按推免从大往小排
char cmps31(stu* a, stu* b);//推免排序,排序按照成绩
char cmps41(stu* a, stu* b);//平均绩点逆序,大的在上
stu* stusort(stu* head, char a(stu* a, stu* b));//学生排序,经典冒泡,cmp表示比较标准

//!!!!!!!!!===================print csv================================

void lunwenprr();//打印认证的那几档
void jingsaiprr();
void stujingprr(stu* node);//打印一个人所有奖项
void coustuprr(Course* node);//打印课程中的所有学生的信息
void jingprr(jing* head);//按照序号把竞赛打印到屏幕上
void teaprr(teacher* head);//按照序号打印老师在屏幕上
void teacouprr(teacher* node);//按照序号打印某个老师教的所有课
void stuperprr(stu* node);//学生单点打印
void stupercsvprr(stu* node);//单点导出一个人的csv文件,存到/output文件夹里面
void stuprr(stu* head);//打印所有学生
void fstuperprr(stu* node);//学生单点写进历史
void coupercsvprr(cource* head);//打印一个科目所有选课同学信息

void stucsvprr(stu* head);//导出csv


//!!!!!!!!!!!===================check========================
stu* checkstu(int& cfg, char arr[], int tar, stu* head);//检查学生密码是否正确0密码错误1登录成功4查无此人
teacher* checktea(int& cfg, int tar, char ppas[], teacher* head);//检查老师密码是否正确0密码错误1正确4查无此人
adm* checkadm(int& opt2, unsigned long long ko, char arg[], adm* head);
//!!!!!!!!!!==================calculation====================
float jidiancalc(float f);//成绩的绩点计算
void stucalc(stu* nnode);//一个学生计算绩点,使用之前保证学生绩点算法未改变
void sturecalc(stu* head);//所有人都重新算绩点

void courperrecalc(Course* nnode);//一个课程重新计算所有人成绩
void courrecalc(Course* head);//重新计算所有人成绩

void getrank(stu* head);//获取排名,使用前请确保排好序


//!!!!!!!!!========================new del==============================
void newstu(char arr[]);//建新学生
void delstu(stu* node);//删除学生
void newtea(char arg[]);

//页面设计
void getwidth(int* width, int* height);
void Print_pdding();
void Print_head();
void Print_tail(int rol);
void Print_line();
void Print_text(const char* s);
void Print_center(const char* s);
void Print_first(const char* s);
const char* concatenateStrings(const char* str1, const char* str2);
char* intToString(int num);
#endif

function.cpp 函数功能实现

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
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
#include"function.h"
//<------------------------------Constexpr---------------------------------------->
float jingji[12];//竞赛绩点
float jidian[14];//分数对应绩点
int point[14];//分数
unsigned long long UPDATE;//系统维护时间
time_t timer; tm* info;//这是时间结构体
FILE* his = gethis();//历史操作,不可更改,只能续写(先加\n)
Course* couhead = NULL;//在程序一开始读入课程基本信息
stu* stuhead = NULL;//在程序一开始读入学生基本信息
teacher* teahead = NULL;//建立老师体系
jing* jinghead = NULL;//建立竞赛体系
adm* admhead;//管理员头头
char Multipl_model[] = "./data/model.txt";//只因器学习的东西,别动就完了
char Logical_model[] = "./data/Model_.txt";//只因器学习的东西,别动就完了
int jingnum;//多少个竞赛?

int length = 60;
int width, height;
int padding = (width - length) / 2;

//<-----------------hisss历史文件选择和记录------------------------------>
FILE *gethis(){
time(&timer);
info=localtime(&timer);
int yy=info->tm_year+1900;
char nname[100]="./log/";
int lll=strlen(nname);
nname[lll]=yy/1000+48;
nname[lll+1]=yy/100%10+48;
nname[lll+2]=yy/10%10+48;
nname[lll+3]=yy%10+48;
yy=info->tm_mon;
nname[lll+4]=yy/10+48;
nname[lll+5]=yy%10+48;
nname[lll+6]='.';
nname[lll+7]='t';
nname[lll+8]='x';
nname[lll+9]='t';
nname[lll+10]='\0';
return fopen(nname,"a");
}


//<------------------------------FILE------------------------------>done
teacher* buildtea(Course* head) {
FILE* ip = fopen("./data/teacher.txt", "r");
teacher* res = (teacher*)malloc(sizeof(teacher));
res->next = NULL;
char a[40], b[5], c[40], e[100];
int d, n;
long long f;
teacher* tmp;
while (fscanf(ip, "%s %s %s %d %s %lld %d", a, b, c, &d, e, &f, &n) != EOF) {
tmp = (teacher*)malloc(sizeof(teacher));
tmp->first = NULL; tmp->teach = NULL; tmp->next = res->next;
res->next = tmp;
strcpy(tmp->sex, b);
strcpy(tmp->pas, c);
strcpy(tmp->name, a);
strcpy(tmp->email, e);
tmp->tel = f;
tmp->tn = n;
tmp->xh = d;
for (int i = 0; i < n; ++i) {
fscanf(ip, "%s", e);
Course* ttmp = coursearch1(head, e);
choose* nnode = (choose*)malloc(sizeof(choose));
nnode->next = tmp->teach;
tmp->teach = nnode;
nnode->tar = ttmp;
}
}
fclose(ip);
return res->next;
}
void getunp(teacher* head) {//从文件读到申请信息
FILE* unp = fopen("./data/unjing.txt", "r");
teacher* tar;
jingupper* tmp;
int xx, nnum, xh;
char buf[200], nnn[100], nname[40];//buf名称,nnn备注
while (fscanf(unp, "%d %s %d %s %s %d", &xx, nname, &xh, buf, nnn, &nnum) != EOF) {
tar = teasearch1(xx, head);
tmp = (jingupper*)malloc(sizeof(jingupper));
strcpy(tmp->ownername, nname);
strcpy(tmp->name, buf);
strcpy(tmp->ppin, nnn);
tmp->xh = xh;
tmp->num = nnum;
tmp->next = tar->first;
tar->first = tmp;
}
fclose(unp);
}
void updunp(teacher* head) {
FILE* unp = fopen("./data/unjing.txt", "w");
jingupper* tmp;
while (head != NULL) {
tmp = head->first;
while (tmp != NULL) {
fprintf(unp, "%d %s %d %s %s %d\n", head->xh, tmp->ownername, tmp->xh, tmp->name, tmp->ppin, tmp->num);
tmp = tmp->next;
}
head = head->next;
}
fclose(unp);
}
Course* ReadCouInfor() {//在程序一开始读入课程基本信息
Course* res = (Course*)malloc(sizeof(Course));
res->next = NULL;
char name[100], num[100], type[20];
float jid;
int r1, r2, t, notic;
FILE* ip = fopen("./data/cources.txt", "r");
while (fscanf(ip, "%s %s %d %f %d %d %s %d", name, num, &t, &jid, &r1, &r2, type, &notic) != EOF) {
Course* tmp = (Course*)malloc(sizeof(Course));
tmp->next = res->next;
res->next = tmp;
if (notic == 1) {
fscanf(ip, "%s", tmp->notice);
}
fscanf(ip, "%d", &tmp->top);
strcpy(tmp->name, name);
strcpy(tmp->number, num);
strcpy(tmp->type, type);
tmp->credit = jid;
tmp->notic = notic;
tmp->Daily = r1;
tmp->hours = t;
tmp->Text = r2;
for (int i = 1; i <= tmp->top; ++i) {
fscanf(ip, "%s %d %f %f", tmp->stu[i].name, &tmp->stu[i].id, &tmp->stu[i].daily, &tmp->stu[i].text);
}
}
fclose(ip);
return res->next;
}
void updcou(Course* head) {
FILE* op = fopen("./data/cources.txt", "w");
for (; head != NULL; head = head->next) {
fprintf(op, "%s %s %d %.1f %d %d %s %d\n", head->name, head->number, head->hours, head->credit, head->Daily, head->Text, head->type, head->notic);
if (head->notic == 1)fprintf(op, "%s\n%d\n", head->notice, head->top);
else fprintf(op, "%d\n", head->top);
for (int i = 1; i <= head->top; ++i) {
fprintf(op, "%s %d %.1f %.1f\n", head->stu[i].name, head->stu[i].id, head->stu[i].daily, head->stu[i].text);
}
}
fclose(op);
}
void updtea(teacher* head) {
FILE* op = fopen("./data/teacher.txt", "w");
for (; head != NULL; head = head->next) {
fprintf(op, "%s %s %s %d %s %lld\n%d\n", head->name, head->sex, head->pas, head->xh, head->email, head->tel, head->tn);
choose* tmp = head->teach;
for (int i = 1; i <= head->tn; ++i, tmp = tmp->next) {
fprintf(op, "%s ", tmp->tar->name);
}
fprintf(op, "\n");
}
fclose(op);
}
void getjidian() {
FILE* ip = fopen("./data/jidian.txt", "r");
for (int i = 0; i < 14; ++i) {
fscanf(ip, "%d %f", &point[i], &jidian[i]);
}
for (int i = 0; i < 12; ++i) {
fscanf(ip, "%f", &jingji[i]);
}
fclose(ip);
}
void updjidian() {
FILE* ip = fopen("./data/jidian.txt", "w");
for (int i = 0; i < 14; ++i) {
fprintf(ip, "%d %f\n", point[i], jidian[i]);
}
for (int i = 0; i < 12; ++i) {
fprintf(ip, "%f ", jingji[i]);
}
fclose(ip);
}
jing* compet() {
FILE* cp = fopen("./data/comp.txt", "r");
jing* head = (jing*)malloc(sizeof(jing));
jing* tmp = head;
int rr;
fscanf(cp, "%d", &jingnum);
for (int i = 0; i < jingnum; ++i) {
tmp->next = (jing*)malloc(sizeof(jing));
tmp = tmp->next;
tmp->next = NULL;
fscanf(cp, "%s %c %c", (tmp->name), &(tmp->flg), &(tmp->ff));
}
fclose(cp);
return head->next;
}
stu* ReadStuInfor(Course* hhead) {
FILE* ip = fopen("./data/student.txt", "r");
stu* res = (stu*)malloc(sizeof(stu)), * tmp = res;
tmp->next = NULL;
int xh;
char sxx[10];
char nname[100];
char pas[40];
while (fscanf(ip, "%s %s %d %s", nname, sxx, &xh, pas) != EOF) {
tmp = (stu*)malloc(sizeof(stu));
tmp->next = res->next;
res->next = tmp;
tmp->prize = NULL; tmp->first = NULL;
tmp->xh = xh;
strcpy(tmp->name, nname);
strcpy(tmp->sex, sxx);
strcpy(tmp->pas, pas);
fscanf(ip, "%d", &tmp->choo);//选几门课,做一个网状链表
for (int h = 0; h < tmp->choo; ++h) {
fscanf(ip, "%s", nname);
choose* ff = (choose*)malloc(sizeof(choose));
ff->next = tmp->first;
tmp->first = ff;
ff->tar = coursearch1(hhead, nname);
}
fscanf(ip, "%d", &tmp->ppri);//是否参加竞赛,参加几个,cpn表示个数,导出填无
for (int kk = 0; kk < tmp->ppri; ++kk) {//竞赛
jingper* ttmp = (jingper*)malloc(sizeof(jingper));
ttmp->next = tmp->prize;
tmp->prize = ttmp;
fscanf(ip, "%s %d %d", ttmp->name, &ttmp->num, &ttmp->flg);
}
}
fclose(ip);
return res->next;
};//在程序一开始读入学生基本信息
void updstu(stu* head) {
FILE* ip = fopen("./data/student.txt", "w");
for (; head != NULL; head = head->next) {
//printf("%s %s %d %s\n",head->name,head->sex,head->xh,head->pas);
//printf("%d\n",head->choo);
fprintf(ip, "%s %s %d %s\n", head->name, head->sex, head->xh, head->pas);
fprintf(ip, "%d\n", head->choo);
for (choose* tmp = head->first; tmp != NULL; tmp = tmp->next) {
fprintf(ip, "%s ", (tmp->tar)->name);
//printf("%s ",(tmp->tar)->name);
}
fprintf(ip, "\n%d\n", head->ppri);//是否参加竞赛,参加几个,cpn表示个数,导出填无
//printf("\n%d\n",head->ppri);//是否参加竞赛,参加几个,cpn表示个数,导出填无
for (jingper* tmp = head->prize; tmp != NULL; tmp = tmp->next) {
//printf("%s %d %d\n",tmp->name,tmp->num,tmp->flg);
fprintf(ip, "%s %d %d\n", tmp->name, tmp->num, tmp->flg);
}
}
fclose(ip);
}
void getadm() {
admhead = NULL;
FILE* ip = fopen("./data/adm.txt", "r");
char buf[100], name[100];
unsigned long long res;
while (fscanf(ip, "%s %s %llu", name, buf, &res) != EOF) {
adm* tmp = (adm*)malloc(sizeof(adm));
tmp->next = admhead;
admhead = tmp;
strcpy(tmp->name, name);
strcpy(tmp->pas, buf);
tmp->xh = res;
}
fclose(ip);
}
void getupdate() {
FILE* ip = fopen("./data/update.txt", "r");
fscanf(ip, "%llu", &UPDATE);
fclose(ip);
}
void updupdate() {
FILE* op = fopen("./data/update.txt", "w");
fprintf(op, "%llu", UPDATE);
fclose(op);
}
void updcomp(jing *head){
FILE *op=fopen("./data/comp.txt","w");
fprintf(op,"%d\n",jingnum);
for(int i=0;i<jingnum;++i){
fprintf(op,"%s %c %d\n",head->name,head->flg,(int)(head->ff-48));
head=head->next;
}
fclose(op);
}
//<------------------------search------------------------------------->
teacher* teasearch1(int tar, teacher* head) {//工号查找
for (teacher* tmp = head; tmp != NULL; tmp = tmp->next) {
if (tar == tmp->xh)return tmp;
}
return NULL;
}
teacher* teasearch2(int tar, teacher* head) {//顺序查找
int n = 1;
for (teacher* tmp = head; tmp != NULL; tmp = tmp->next) {
if (tar == n)return tmp;
n++;
}
return NULL;
}
jing* jingsearch(int cnt, jing* head) {//按照序号查找竞赛名字
for (int n = 1; head != NULL; head = head->next) {
if (n == cnt)return head;
n++;
}
return NULL;
}
Course* coursearch1(Course* head, char arr[]) {//按课程名字查找课程
for (; head != NULL; head = head->next) {
if (strcmp(arr, head->name) == 0)
return head;
}
return NULL;
}
Course* cousearch1(Course* head, int num) {
for (int i = 1; head != NULL; ++i, head = head->next) {
if (num == i)return head;
}
return NULL;
}
int courstusearch1(Course* nnode, int xh, float& res) {//按学号课程中查找学生的位置,返回位号(int)和成绩
for (int i = 1; i <= nnode->top; ++i) {//排好序的话返回值就是排名了
if (nnode->stu[i].id == xh) {
res = nnode->stu[i].final;
return i;
}
}
res = 0;
return 0;
}
int courstusearch2(Course* nnode, char arr[], float& res) {//按名字课程中查找学生的位置,返回位号(int)
for (int i = 1; i <= nnode->top; ++i) {
if (strcmp(nnode->stu[i].name, arr) == 0) {
res = nnode->stu[i].final;
return i;
}
}
res = 0;
return 0;
}

stu* stusearch1(char arr[], stu* head) {//姓名查找
for (stu* tmp = head; tmp != NULL; tmp = tmp->next) {
if (strcmp(tmp->name, arr) == 0)return tmp;
}
return NULL;
}
stu* stusearch2(int tar, stu* head) {//学号查找
for (stu* tmp = head; tmp != NULL; tmp = tmp->next) {
if (tar == tmp->xh)
return tmp;
}
return NULL;
}
stu* stusearch3(int tar, stu* head) {//顺序查找
int i = 1;
for (stu* tmp = head; tmp != NULL; tmp = tmp->next, ++i) {
if (tar == i)return tmp;
}
return NULL;
}

//<--------------------------check-------------------------------->
stu* checkstu(int& cfg, char arr[], int tar, stu* head) {//检查学生密码是否正确0密码错误1登录成功4查无此人
for (stu* tmp = head; tmp != NULL; tmp = tmp->next) {
if (tmp->xh == tar) {
if (strcmp(tmp->pas, arr) == 0) {
cfg = 1;
return tmp;
}
else {
cfg = 0;
return NULL;
}
}
}
cfg = 4;
return NULL;
}
teacher* checktea(int& cfg, int tar, char ppas[], teacher* head) {//检查老师密码是否正确0密码错误1正确4查无此人
for (teacher* tmp = head; tmp != NULL; tmp = tmp->next) {
if (tmp->xh == tar) {
if (strcmp(tmp->pas, ppas) == 0) {
cfg = 1;
return tmp;
}
else {
cfg = 0;
return NULL;
}
}
}
cfg = 4;
return NULL;
}
adm* checkadm(int& opt2, unsigned long long ko, char arg[], adm* head) {
for (adm* tmp = head; tmp != NULL; tmp = tmp->next) {
if (tmp->xh == ko) {
if (strcmp(tmp->pas, arg) == 0) {
opt2 = 1;
return tmp;
}
else {
opt2 = 0;
return NULL;
}
}
}
opt2 = 4;
return NULL;
}
//<--------------------------sort cmp rank-------------------------------->
char cmpc11(Student a, Student b) {
return a.final < b.final;
}
char cmpc12(Student a, Student b) {
return a.final > b.final;
}
char cmpc21(Student a, Student b) {
return a.text < b.text;
}
char cmpc22(Student a, Student b) {
return a.text > b.text;
}
char cmpc31(Student a, Student b) {
return a.daily < b.daily;
}
char cmpc32(Student a, Student b) {
return a.daily > b.daily;
}
char cmpc41(Student a, Student b) {
if (a.id / 100 == b.id / 100) {
return a.final < b.final;
}
return a.id > b.id;
}
char cmpc42(Student a, Student b) {
if (a.id / 100 == b.id / 100) {
return a.final > b.final;
}
return a.id > b.id;
}
void coursort(Course* nnode, char a(Student a, Student b)) {//一个课程排序,经典冒泡
char ff = 1;
Student c;
while (ff) {
ff = 0;
for (int i = 1; i < nnode->top; ++i) {
if (a(nnode->stu[i], nnode->stu[i + 1])) {
c = nnode->stu[i];
nnode->stu[i] = nnode->stu[i + 1];
nnode->stu[i + 1] = c;
ff = 1;
}
}
}
}




char cmps10(stu* a, stu* b) {
return (a->xh) > (b->xh);
}//学号逆序,小的在上
char cmps21(stu* a, stu* b) {
if (a->xh / 100 == b->xh / 100) {
return a->over < b->over;
}
return a->xh > b->xh;
}//班号排序,一个班的按成绩从大往小排
char cmps22(stu* a, stu* b) {
if (a->xh / 100 == b->xh / 100) {
return cmps31(a, b);
}
return a->xh > b->xh;
}//班号排序,一个班的按推免从大往小排
char cmps31(stu* a, stu* b) {
if (a->ff == b->ff) {
return a->over < b->over;
}
return a->ff > b->ff;
}//推免排序,排序按照成绩
char cmps41(stu* a, stu* b) {
return (a->over) < (b->over);
}//平均绩点逆序,大的在上
stu* stusort(stu* head, char a(stu* a, stu* b)) {//排序,经典冒泡,cmp表示比较标准
stu* res = (stu*)malloc(sizeof(stu));
res->next = head;
char ff = 0;
do {
ff = 0;
for (stu* aa = res, *bb = aa->next, *cc = bb->next; cc != NULL; aa = bb, bb = cc, cc = cc->next) {
if (a(bb, cc)) {
aa->next = cc;
bb->next = cc->next;
cc->next = bb;
ff = 1;
bb = cc;
cc = cc->next;
}
}
} while (ff);
return res->next;
}


void getrank(stu* head) {//获取排名,使用前请确保排好序
for (int i = 1; head != NULL; ++i, head = head->next) {
head->rank = i;
}
}

//<-----------------------------print csv------------------------------------>

void lunwenprr() {
for (int i = 0; i < 30; i++) {
printf(" ");
}
for (int i = 0; i < 100; ++i) {
printf("=");
}
printf("\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("1档 业界公认顶级期刊(CELL,NATURE,SCIENCE)\n");
printf("\n");
printf("\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("2档 CCF-A期刊或CCF-A会议长文或CCF-B会议的最佳论文/最佳学生论文\n");
printf("\n");
printf("\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("3档 CCF-B期刊论文或中科院期刊分区一区论文或CCF-C会议的最佳论文/最佳学生论文国家级优秀结题项目负责人\n");
printf("\n");
printf("\n");
//printf(" \n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("4档 CCF-C期刊论文或CCF-B会议长文或中科院期刊分区二区论文或计算机学报,软件学报发表的学术论文\n");
printf("\n");
printf("\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("5档 影响因子非0的SCI检索期刊论文或CCF-C会议长文或中国科学:信息科学、计算机研究与发展、计算机辅助设计与\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("研究学报、电子学报中文版、自动化学报发表的学术论文\n");
printf("\n");
printf("\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("6档 EI检索期刊\n");
printf("\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
for (int i = 0; i < 100; ++i) {
printf("=");
}
printf("\n");

}
void jingsaiprr() {
Print_head();
Print_line();
Print_first("1档 A类竞赛国家级一等奖(金奖)");
Print_line();
Print_first("2档 A类竞赛国家级一等奖(银奖)");
Print_line();
Print_first(" B类竞赛国家级等奖(金奖)");
Print_line();
Print_first("3档 A类竞赛国家级一等奖(铜奖)");
Print_line();
Print_first(" B类竞赛国家级一等奖(银奖)");
Print_line();
Print_first(" C类竞赛国家级等奖(金奖)");
Print_line();
Print_first("4档 B类竞赛国家级一等奖(铜奖)");
Print_line();
Print_first(" C类竞赛国家级一等奖(银奖)");
Print_line();
Print_first("5档 C类竞赛国家级等奖(铜奖)");
Print_tail(1);



//printf("\n1档 A类竞赛国家级一等奖(金奖)");
//printf("\n2档 A类竞赛国家级一等奖(银奖)");
//printf("\n B类竞赛国家级等奖(金奖)");
//printf("\n3档 A类竞赛国家级一等奖(铜奖)");
//printf("\n B类竞赛国家级一等奖(银奖)");
//printf("\n C类竞赛国家级等奖(金奖)");
//printf("\n4档 B类竞赛国家级一等奖(铜奖)");
//printf("\n C类竞赛国家级一等奖(银奖)");
//printf("\n5档 C类竞赛国家级等奖(铜奖)");
}

void stujingprr(stu* node) {//打印一个人所有奖项
printf("\n");
printf("\n");
if (node->prize == NULL) {
Print_pdding();
printf("无奖项\n");
return;
}
jingper* tmp = node->prize;
Print_pdding();
for (int i = 0; i < length; i++) {
printf("=");
}
printf("\n");
printf("\n");
for (int i = 1; i <= node->ppri; ++i) {
Print_pdding();
printf("%d\t%-40s\t%d等奖\n", i, tmp->name, tmp->num);
tmp = tmp->next;
}
printf("\n");
Print_pdding();
for (int i = 0; i < length; i++) {
printf("=");
}
printf("\n");
}
void jingprr(jing* head) {//按照序号把竞赛打印到屏幕上
int i = 1;
for (int i = 0; i < 30; i++) {
printf(" ");
}
for (int i = 0; i < 100; ++i) {
printf("=");
}
printf("\n");
for (jing* tmp = head; tmp != NULL; tmp = tmp->next) {
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("%d %s %c\n", i, tmp->name, tmp->flg);
++i;
}
for (int i = 0; i < 30; i++) {
printf(" ");
}
for (int i = 0; i < 100; ++i) {
printf("=");
}
}
void teaprr(teacher* head) {//按照序号打印老师在屏幕上
int cnt = 1;
Print_head();
Print_line();
while (head != NULL) {
//将数字与字符串连接
char str[50];
sprintf(str, "%d", cnt);
char* name1 = (char*)malloc(strlen(head->name) + 1);
strcpy(name1, head->name);
strcat(str, " ");
strcat(str, name1);
Print_first(str);
Print_line();
//printf("%d %s\n", cnt, head->name);
free(name1);
head = head->next;
cnt++;
}
Print_tail(1);
printf("\n");
printf("\n");
return;
}

void teacouprr(teacher* node) {

choose* tmp = node->teach;
char** Name = (char**)malloc(sizeof(char*)*50);
for (int i = 1; i <= node->tn; ++i) {
char str[50];
sprintf(str, "%d", i);
Name[i] = (char*)malloc(strlen(tmp->tar->name) + 1);
strcpy(Name[i], tmp->tar->name);
strcat(str, " ");
strcat(str, Name[i]);
Print_first(str);
Print_line();
tmp = tmp->next;
}
Print_tail(1);
printf("\n");
printf("\n");
for (int i = 1; i <= node->tn; ++i) {
free(Name[i]);
}
free(Name);
}

void coustuprr(Course* node) {
printf("\n");
printf("\n");
Print_pdding();
for (int i = 0; i < length + 3; i++) {
printf("=");
}
printf("\n");
printf("\n");
Print_pdding();
printf("序号 学号\t\t 姓名\t\t平时成绩 考试成绩 最终成绩\n");
printf("\n");
for (int i = 1; i <= node->top; ++i) {
Print_pdding();
printf("%-8d%-d\t %-10s\t%-10.1f%-10.1f%-10.1f\n", i, node->stu[i].id, node->stu[i].name, node->stu[i].daily, node->stu[i].text, node->stu[i].final);
printf("\n");
}
printf("\n");
Print_pdding();
for (int i = 0; i < length + 3; i++) {
printf("=");
}
printf("\n");

}
void stuperprr(stu* node) {//学生单点打印

char str[8];
//绩点转换成字符串
sprintf(str, "%.3f", node->over);
char* Name = (char*)malloc(sizeof(char*));
strcpy(Name, node->name);
const char* a = { "的最终绩点:" };
char str1[10];
sprintf(str1, "%d", node->rank);
const char* b = { "当前排名:" };
strcat(Name, a);
strcat(Name, str);
Print_text(Name);
Print_text(concatenateStrings(b, str1));
Print_tail(1);
printf("\n");
Print_pdding();
for (int i = 0; i < length + 3; i++) {
printf("=");
}
printf("\n");
Print_pdding();
printf("各科成绩如下:\n");
printf("\n");
choose* tmp = node->first;
int num = 0; float res = 0;
Print_pdding();
printf("课程\t\t平时成绩\t考试成绩\t最终成绩\t绩点\n");
printf("\n");
for (int i = 0; i < node->choo; ++i, tmp = tmp->next) {
num = courstusearch1(tmp->tar, node->xh, res);
Print_pdding();
printf("%-10s\t%-6.1f\t\t%-6.1f\t\t%-6.1f\t\t%-6.1f\n", tmp->tar->name, tmp->tar->stu[num].daily, tmp->tar->stu[num].text, res, jidiancalc(res));
printf("\n");
}
Print_pdding();
for (int i = 0; i < length + 3; i++) {
printf("=");
}
printf("\n");
if (node->prize != NULL)//主要是没得奖的看到这个会很不爽
{
Print_pdding();
printf("获得了:\n");
printf("\n");
}
for (jingper* kk = node->prize; kk != NULL; kk = kk->next) {
Print_pdding();
printf("%s的%d等奖\n", kk->name, kk->num);
printf("\n");
}
}
void fstuperprr(stu* node) {//学生单点打印
fprintf(his, "\n%s的最终绩点:%.3f\n当前排名:%d\n", node->name, node->over, node->rank);
fprintf(his, "各科成绩如下:\n");
printf("\n");
choose* tmp = node->first;
int num = 0; float res = 0;
fprintf(his, "课程 平时成绩 考试成绩 最终成绩 绩点\n");
for (int i = 0; i < node->choo; ++i, tmp = tmp->next) {
num = courstusearch1(tmp->tar, node->xh, res);
fprintf(his, "%s %.1f %.1f %.1f %.1f\n", tmp->tar->name, tmp->tar->stu[num].daily, tmp->tar->stu[num].text, res, jidiancalc(res));
}
if (node->prize != NULL)//主要是没得奖的看到这个会很不爽
{
Print_pdding();
fprintf(his, "获得了:\n");
}
for (jingper* kk = node->prize; kk != NULL; kk = kk->next) {
fprintf(his, "%s的%d等奖\n", kk->name, kk->num);
}
}
void stupercsvprr(stu* node) {//单点导出一个人的csv文件,存到/output文件夹里面
char csvname[60];
strcpy(csvname, "./output/");
strcpy(csvname + 9, node->name);
int len = strlen(csvname);
csvname[len] = '.', csvname[len + 1] = 'c', csvname[len + 2] = 's', csvname[len + 3] = 'v', csvname[len + 4] = '\0';
printf("%s", csvname);
FILE* op = fopen(csvname, "w");
fprintf(op, "%s,绩点,%.3f,排名,%d\n", node->name, node->over, node->rank);
fprintf(op, "学科,平时分,考试分,最终成绩,绩点\n");
choose* tmp = node->first;
int num = 0; float res = 0;
for (int i = 0; i < node->choo; ++i, tmp = tmp->next) {
num = courstusearch1(tmp->tar, node->xh, res);
fprintf(op, "%s,%.1f,%.1f,%.1f,%.1f\n", tmp->tar->name, tmp->tar->stu[num].daily, tmp->tar->stu[num].text, res, jidiancalc(res));
}
if (node->prize != NULL)//主要是没得奖的看到这个会很不爽
fprintf(op, "奖项状况\n");
for (jingper* kk = node->prize; kk != NULL; kk = kk->next) {
fprintf(op, "%s,%d等奖\n", kk->name, kk->num);
}
fclose(op);
}

void coupercsvprr(cource* node) {
char csvname[70];
strcpy(csvname, "./output/");
strcpy(csvname + 9, node->name);
int len = strlen(csvname);
csvname[len] = '.', csvname[len + 1] = 'c', csvname[len + 2] = 's', csvname[len + 3] = 'v', csvname[len + 4] = '\0';
FILE* op = fopen(csvname, "w");
fprintf(op, "课程名称,课程编号,课程类型,学分,学时,平时分占比,考试分占比,选课人数\n");
fprintf(op, "%s,%s,%s,%.1f,%d,%d,%d,%d\n", node->name, node->number, node->type, node->credit, node->hours, node->Daily, node->Text, node->top);
fprintf(op, "姓名,学号,平时分,考试分,总成绩,绩点\n");
for (int i = 1; i <= node->top; ++i) {
fprintf(op, "%s,%d,%.1f,%.1f,%.1f,%.1f\n", node->stu[i].name, node->stu[i].id, node->stu[i].daily, node->stu[i].text, node->stu[i].final, jidiancalc(node->stu[i].final));
}
fclose(op);
}

void stuprr(stu* head) {//打印所有学生
printf("\n");
printf("\n");
Print_pdding();
for (int i = 0; i < length + 3; i++) {
printf("=");
}
printf("\n");
printf("\n");
Print_pdding();
printf("序号 学号\t\t 姓名\t\t性别 绩点\t排名\n");
for (int i = 1; head != NULL; ++i, head = head->next) {
Print_pdding();
printf("%-8d%-d\t %-10s\t%-6s %-.3f\t%-3d\n", i, head->xh, head->name, head->sex, head->over, head->rank);
}
printf("\n");
Print_pdding();
for (int i = 0; i < length + 3; i++) {
printf("=");
}
printf("\n");
printf("\n");


}


void stucsvprr(stu* head) {
FILE* op = fopen("./output/学生.csv", "w");
fprintf(op, "序号,推免资格,学号,姓名,性别,绩点");
for (int i = 1; head != NULL; ++i, head = head->next) {
fprintf(op, "\n%d,%d,%d,%s,%s,%.3f", i,head->ff^1, head->xh, head->name, head->sex, head->over);
}
fclose(op);
}
//<--------------------------------calculation------------------------------>
float jidiancalc(float f) {
for (int i = 0; i < 14; ++i) {//绩点计算
if (f >= point[i]) {
return jidian[i];
}
}
}
void sturecalc(stu* head) {//所有人都重新算绩点
for (; head != NULL; head = head->next) {
stucalc(head);
}
}
void courperrecalc(Course* nnode) {//一个课程重新计算所有人成绩
for (int i = 1; i <= nnode->top; ++i) {
nnode->stu[i].final = (nnode->stu[i].daily * nnode->Daily + nnode->stu[i].text * nnode->Text) / 100;
}
}
void courrecalc(Course* head) {//所有课程重新计算所有人成绩
for (; head != NULL; head = head->next) {
courperrecalc(head);
}
}
void stucalc(stu* nnode) {//一个学生计算绩点,使用之前保证学生绩点算法未改变
nnode->over = 0;
float xf = 0;//学分存储
for (choose* aa = nnode->first; aa != NULL; aa = aa->next) {
float rres;
courstusearch1(aa->tar, nnode->xh, rres);
rres = jidiancalc(rres);
if (rres <= 0) {
nnode->ff = 1;
}
if (strcmp(aa->tar->type, "必修") == 0 || strcmp(aa->tar->type, "限选") == 0) {
nnode->over += aa->tar->credit * rres;
xf += aa->tar->credit;
}
}
if (nnode->ff != 1)nnode->ff = 0;//防止野值
if (xf != 0)
nnode->over /= xf;
float rett = 0;//临时竞赛绩点存放
int gh = 0;//状压对象
for (jingper* tmp = nnode->prize; tmp != NULL; tmp = tmp->next) {//竞赛绩点计算
if (tmp->flg < 10) {//竞赛
gh |= 1 << (tmp->flg);
if (tmp->flg >= 5)
gh |= 1 << (tmp->flg - 5);
}
else {//论文
gh |= 1 << tmp->flg;
}
}
do {
int h = lowbit(gh);
gh ^= h;
switch (h) {
case 1 << 15: {//论文范围
rett += jingji[5];
break;
}case 1 << 14: {
rett += jingji[4];
break;
}case 1 << 13: {
rett += jingji[3];
break;
}case 1 << 12: {
rett += jingji[2];
break;
}case 1 << 11: {
rett += jingji[1];
break;
}case 1 << 10: {
rett += jingji[0];
break;
}case 1 << 9: {//竞赛范围
rett += jingji[6];
break;
}case 1 << 8: {
rett += jingji[7];
break;
}case 1 << 7: {
rett += jingji[8];
break;
}case 1 << 6: {
rett += jingji[9];
break;
}case 1 << 5: {
rett += jingji[10];
break;
}case 1 << 4: {
rett += jingji[6];
break;
}case 1 << 3: {
rett += jingji[7];
break;
}case 1 << 2: {
rett += jingji[8];
break;
}case 1 << 1: {
rett += jingji[9];
break;
}case 1: {
rett += jingji[10];
break;
}
}
} while (gh);
if (rett > 0.4)rett = 0.4;
nnode->over += rett;
return;
}

void dfs(char arr[], int xh) {
arr[6] = '\0';
arr[0] = xh % 1000000 / 100000 + 48;
arr[1] = xh % 100000 / 10000 + 48;
arr[2] = xh % 10000 / 1000 + 48;
arr[3] = xh % 1000 / 100 + 48;
arr[4] = xh % 100 / 10 + 48;
arr[5] = xh % 10 + 48;
}



//<--------------------------------machine learn------------------------------->
void load_MRmodel(char* model_filename, MR_Model* model) {
FILE* file = fopen(model_filename, "r");
if (file == NULL) {
perror("Error opening file");
return;
}
for (int i = 0; i < FEATURE_MAX; i++) {
fscanf(file, "%lf", &model->w[i]);
}
fscanf(file, "%lf", &model->b);
fclose(file);
}//加载多元线性回归模型
void load_LRmodel(char* model_filename, LR_Model* model) {
FILE* file = fopen(model_filename, "r");
if (file == NULL) {
perror("Error opening file");
return;
}
for (int i = 0; i < NUM_FEATURES; i++) {
fscanf(file, "%lf", &model->weights[i]);
}
fscanf(file, "%lf", &model->bias);
fclose(file);
}//加载逻辑回归模型
double LR_predict(LR_Model* model, LR_Sample* LR_Sample) {
double z = model->bias;
for (int i = 0; i < NUM_FEATURES; i++) {
z += model->weights[i] * LR_Sample->features[i];
}
double a = 1 / (1 + exp(-z));
return a;
}
double MR_predict(MR_Model* model, MR_Sample* MR_Sample) {
double result = 0;
for (int i = 0; i < 10; i++)
{
result += MR_Sample[0].feature[i] * model->w[i];
}
result += model->b;
return result;
}
void Gradeprdict() {
cls;
float max[FEATURE_MAX] = { 100,100,100,99.99,4,3.5,8,11,15,450 };
float min[FEATURE_MAX] = { 40,40,40,0.08,0,0,0.5,5,8,1 };
MR_Model* multip_model = (MR_Model*)malloc(sizeof(MR_Model));
MR_Sample* Student = (MR_Sample*)malloc(sizeof(MR_Sample));
load_MRmodel(Multipl_model, multip_model);
int i = 0;
while (i < 10)
{
switch (i)
{
case 0:
{
Print_pdding();
printf("请输入第一次作业成绩(百分制):");
scanf("%lf", &Student[0].feature[0]);
i++;
}
break;
case 1:
{
Print_pdding();
printf("请输入第二次作业成绩(百分制):");
scanf("%lf", &Student[0].feature[1]);
i++;
}
break;
case 2:
{
Print_pdding();
printf("请输入第三次作业成绩(百分制):");
scanf("%lf", &Student[0].feature[2]);
i++;
}
break;
case 3:
{
Print_pdding();
printf("请输入作业完成情况(%%):");
scanf("%lf", &Student[0].feature[3]);
i++;
}
break;
case 4:
{
Print_pdding();
printf("请输入本学科学习时间(小时):");
scanf("%lf", &Student[0].feature[4]);
i++;
}
break;
case 5:
{
Print_pdding();
printf("请输入运动时间(小时):");
scanf("%lf", &Student[0].feature[5]);
i++;
}
break;
case 6:
{
Print_pdding();
printf("请输入睡眠时间(小时):");
scanf("%lf", &Student[0].feature[6]);
i++;
}
break;
case 7:
{
Print_pdding();
printf("请输入娱乐时间(小时):");
scanf("%lf", &Student[0].feature[7]);
i++;
}
break;
case 8:
{
Print_pdding();
printf("请输入选课数量(节):");
scanf("%lf", &Student[0].feature[8]);
i++;
}
break;
case 9:
{
Print_pdding();
printf("请输入平均排名(名):");
scanf("%lf", &Student[0].feature[9]);
i++;
}
break;
}
}
for (int i = 0; i < 10; i++)
{
Student->feature[i] = (Student->feature[i] - min[i]) / (max[i] - min[i]);
}
double result = MR_predict(multip_model, Student);
if (result > 100)
result = 100;
else if(result<0)
result = 0;
Print_pdding();
printf("预测期末成绩为:%.1f\n", result);
free(Student);
free(multip_model);
}//成绩预测
void Learning_state() {
LR_Model* logical_model = (LR_Model*)malloc(sizeof(LR_Model));
LR_Sample* student = (LR_Sample*)malloc(sizeof(LR_Sample));
load_LRmodel(Logical_model, logical_model);
float max[NUM_FEATURES] = { 99.96,100,100,10,2,12,5,14,449 };
float min[NUM_FEATURES] = { 0.04,50.01,0.06,0,0, 5,0,8,1 };
int i = 0;
while (i < 9)
{
switch (i)
{
case 0:
{
Print_pdding();
printf("请输入你现阶段的考试成绩(百分制):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
case 1:
{
Print_pdding();
printf("请输入你现阶段的出勤率(%%):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
case 2:
{
Print_pdding();
printf("请输入你现阶段的作业完成情况(%%):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
case 3:
{
Print_pdding();
printf("请输入你现阶段的学习时间(小时):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
case 4:
{
Print_pdding();
printf("请输入你现阶段的运动时间(小时):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
case 5:
{
Print_pdding();
printf("请输入你现阶段的睡眠时间(小时):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
case 6:
{
Print_pdding();
printf("请输入你现阶段的娱乐时间(小时):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
case 7:
{
Print_pdding();
printf("请输入你这学期的选课数量(节):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
case 8:
{
Print_pdding();
printf("请输入你上学期的排名(名):");
scanf("%lf", &student->features[i]);
printf("\n");
i++;
}
break;
}
}
for (int i = 0; i < NUM_FEATURES; i++) {
student->features[i] = (student->features[i] - min[i]) / (max[i] - min[i]);
}
double result = LR_predict(logical_model, student);
if (result > 0.5)
{
Print_pdding();
printf("学习状态:良好\n");
}
else
{
Print_pdding();
printf("学习状态:较差\n");
}

free(student);
free(logical_model);
}//逻辑回归判断学习状态好坏
//<------------------------------delete new---------------------------------->
void delstu(stu* node) {
if (stuhead == node) {
stuhead = stuhead->next;
}
else {
for (stu* tmp = stuhead; tmp->next != NULL; tmp = tmp->next) {
if (tmp->next == node) {
tmp->next = node->next;
break;
}
}
}
float a;
for (choose* tmp = node->first; tmp != NULL; tmp = tmp->next) {
int rres = courstusearch1(tmp->tar, node->xh, a);
tmp->tar->stu[rres] = tmp->tar->stu[tmp->tar->top];
tmp->tar->top--;
}
}
void newstu(char arr[]) {
cls;
stu* hi = (stu*)malloc(sizeof(stu));
hi->first = NULL;
hi->prize = NULL;
char buf[100];
int x;
printf("\n");
printf("\n");
Print_pdding();
printf("请输入新同学的名字:\n");
Print_pdding();
scanf("%s", hi->name);
printf("\n");
Print_pdding();
printf("请输入新同学的性别:\n");
Print_pdding();
scanf("%s", hi->sex);
rep100007:
printf("\n");
Print_pdding();
printf("请输入新同学的学号:\n");
Print_pdding();
scanf("%d", &hi->xh);
printf("\n");
for (stu* tmp = stuhead; tmp != NULL; tmp = tmp->next) {
if (tmp->xh == hi->xh) {
Print_pdding();
printf("学号重复,请重新输入。\n");
goto rep100007;
}
}
Print_pdding();
dfs(hi->pas, hi->xh);
printf("请输入新同学的选课个数:\n");
Print_pdding();
scanf("%d", &hi->choo);
printf("\n");
for (int i = 0; i < hi->choo; ++i) {
choose* yo = (choose*)malloc(sizeof(yo));
rep91:
Print_pdding();
printf("请输入新同学的选课名字:\n");
Print_pdding();
scanf("%s", buf);
printf("\n");
Course* che= coursearch1(couhead, buf);
if (che == NULL) {
Print_pdding();
printf("课程不存在,请重新输入。\n");
goto rep91;
}
yo->tar = che;
x = ++(yo->tar->top);
yo->next = hi->first;
hi->first = yo;
Print_pdding();
printf("请输入该同学平时分:\n");
Print_pdding();
scanf("%f", &yo->tar->stu[x].daily);
printf("\n");
Print_pdding();
printf("请输入该同学考试分:\n");
Print_pdding();
scanf("%f", &yo->tar->stu[x].text);
printf("\n");
strcpy(yo->tar->stu[x].name, hi->name);
yo->tar->stu[x].id = hi->xh;
}
Print_pdding();
printf("请输入新同学的竞赛获奖个数:\n");
Print_pdding();
scanf("%d", &hi->ppri);
printf("\n");
for (int i = 0; i < hi->ppri; ++i) {
jingper* rres = (jingper*)malloc(sizeof(jingper));
rres->next = hi->prize;
hi->prize = rres;
rrep1:
Print_pdding();
printf("请输入他的获奖种类:\n");
printf("\n");
Print_pdding();
printf("1.竞赛 2.论文\n");
Print_pdding();
scanf("%d", &x);
switch (x) {
case 1: {
cls;
jingprr(jinghead);
Print_pdding();
printf("请按照标号选择目标竞赛:");
Print_pdding();
scanf("%d", &x);
jing* jkl = jingsearch(x, jinghead);
if (jkl != NULL) {
Print_pdding();
printf("请输入获奖等级:\n");
Print_pdding();
scanf("%d", &x);
strcpy(rres->name, jkl->name);
rres->flg = 3 - x + ((jkl->ff == 1) ? 5 : 0) + ((jkl->flg == 'A') ? 2 : (jkl->flg == 'C') ? 0 : 1);
rres->num = x;
Print_pdding();
printf("奖项认证成功。\n");
fprintf(his, "\n%s授予%s", arr, hi->name);//历史
}
else {
cls;
Print_pdding();
printf("操作数无效。请重新输入。\n");
sl(2000);
goto rrep1;
}
break;
}
case 2: {
cls;
lunwenprr();
Print_pdding();
printf("\n论文分为六档,请输入申请人的论文是第几档:\n");
Print_pdding();
scanf("%d", &x);
rres->num = x;
rres->flg = x + 9;
Print_pdding();
printf("请输入论文名字:\n");
Print_pdding();
scanf("%s", rres->name);
Print_pdding();
printf("奖项认证成功。\n");
fprintf(his, "\n%s授予%s", arr, hi->name);//历史
break;
}
default: {
Print_pdding();
printf("操作数无效,请重新输入。");
goto rrep1;
}
}
}
hi->next = stuhead;
stuhead = hi;
stucalc(hi);
cls;
Print_pdding();
printf("新同学添加成功。");
sl(2000);

}
void newtea(char arg[]) {
teacher* res = (teacher*)malloc(sizeof(teacher));//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
res->next = teahead;
teahead = res;
char buf[100];
res->first = NULL;
Print_pdding();
printf("请输入新老师的姓名:\n");
Print_pdding();
scanf("%s", res->name);
Print_pdding();
printf("请输入新老师的性别:\n");
Print_pdding();
scanf("%s", res->sex);
Print_pdding();
printf("请输入新老师的工号:\n");
Print_pdding();
scanf("%d", &res->xh);
dfs(res->pas, res->xh);
Print_pdding();
printf("请输入新老师的电话:\n");
Print_pdding();
scanf("%lld", &res->tel);
Print_pdding();
printf("请输入新老师的电子邮件地址:\n");
Print_pdding();
scanf("%s", res->email);
Print_pdding();
printf("请输入新老师的所教课程数:\n");
Print_pdding();
scanf("%d",&res->tn);
for (int i = 0; i < res->tn; ++i) {
Print_pdding();
printf("请输入新老师的所教课程:\n");
choose* tmp = (choose*)malloc(sizeof(choose));
Print_pdding();
scanf("%s", buf);
tmp->tar = coursearch1(couhead, buf);
tmp->next = res->teach;
res->teach = tmp;
}
Print_pdding();
printf("新老师添加成功。\n");
fprintf(his, "管理员%s添加了新老师:%s", arg, res->name);
}

//页面设计
void getwidth(int* width, int* height) {
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
*width = csbi.srWindow.Right - csbi.srWindow.Left + 1;
*height = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
return;
}
void Print_pdding() {
for (int i = 0; i < padding; i++) {
printf(" ");
}
return;
}
void Print_head() {
for (int i = 0; i < 3; i++) {
printf("\n");
}
Print_pdding();
printf("┏");
for (int i = 0; i < length; i++) {
printf("━");
}
printf("┓\n");
return;
}//打印表头
void Print_tail(int rol) {
for (int i = 0; i < rol; i++) {
Print_line();
}
Print_pdding();
printf("┗");
for (int i = 0; i < length; i++) {
printf("━");
}
printf("┛\n");
return;
}//打印表尾
void Print_line() {
Print_pdding();
printf("┃");
for (int i = 0; i < length; i++) {
printf(" ");
}
printf("┃\n");
return;
}//打印分割线
void Print_text(const char* s) {
int len = strlen(s);
int pdd = 18;
int y = length - len - pdd;
Print_pdding();
printf("┃");
for (int i = 0; i < pdd; i++) {
printf(" ");
}
printf("%s", s);
for (int i = 0; i < y; i++) {
printf(" ");
}
printf("┃\n");
return;
}
void Print_center(const char* s) {
int len = strlen(s);
Print_pdding();
printf("┃");
for (int i = 0; i < (length - len) / 2; i++) {
printf(" ");
}
printf("%s", s);
for (int i = 0; i < (length - len) / 2; i++) {
printf(" ");
}
printf("┃\n");
return;
}
void Print_first(const char* s) {
int len = strlen(s);
int pdd = 4;
int y = length - len - pdd;
Print_pdding();
printf("┃");
for (int i = 0; i < pdd; i++) {
printf(" ");
}
printf("%s", s);
for (int i = 0; i < y; i++) {
printf(" ");
}
printf("┃\n");
return;
}
const char* concatenateStrings(const char* str1, const char* str2) {
size_t len1 = strlen(str1);
size_t len2 = strlen(str2);
size_t totalLen = len1 + len2 + 1; // 加1是为了结束符 '\0'

char* result = (char*)malloc(totalLen * sizeof(char));
if (result == NULL) {
return NULL;
}

strcpy(result, str1);
strcat(result, str2);

return (const char*)result;
}
char* intToString(int num) {
// 计算所需的字符串长度,包括负号和终止符
int length = num <= 0 ? 2 : 1; // 如果是0或负数,需要额外一个字符存储负号
int n = num;
while (n != 0) {
n /= 10;
length++;
}

char* str = (char*)malloc(length * sizeof(char));
if (str == NULL) {
return NULL; // 内存分配失败
}
// 使用sprintf将整数转换为字符串
sprintf(str, "%d", num);
return str;
}

main.cpp 主框架实现

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
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
#include"function.h"



//最终版本

//<-------------------------------------Main---------------------------------->
int main(){


//printf("┃━ ┓ ┗ ┏ ┛");
//system("mode con cols=160 lines=40 ");
system("mode con cols=160");
CONSOLE_FONT_INFOEX cfi;//用于存储即将设置的字体信息。
cfi.cbSize = sizeof(cfi);//设置结构体大小
cfi.nFont = 0;//字体索引
cfi.dwFontSize.X = 10;//宽度
cfi.dwFontSize.Y = 20;//高度
cfi.FontFamily = FF_DONTCARE;//字体族
cfi.FontWeight = FW_BOLD;//字体加粗
wcscpy(cfi.FaceName, L"楷体"); // 设置字体名称为楷体

// 设置控制台字体
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);

SetConsoleTitleW(L"学生成绩管理系统");
system("color 70");

getwidth(&width, &height);
padding = (width - length) / 2;


getupdate();
getadm();
getjidian();
couhead=ReadCouInfor();//在程序一开始读入课程基本信息
stuhead=ReadStuInfor(couhead);//在程序一开始读入学生基本信息
teahead=buildtea(couhead);//建立老师体系
jinghead=compet();//建立竞赛体系
getunp(teahead);//获取未处理的奖项

courrecalc(couhead);//算成绩
sturecalc(stuhead);//算绩点
stuhead=stusort(stuhead,cmps31);
getrank(stuhead);//算排名

//<----------------------------------menu--------------------------------->
int opt1=0,opt2=0;
char arr[100];
bbegin:
cls;
Print_head();
Print_center("欢迎使用学生成绩管理系统");
Print_line();
Print_line();
Print_text("1.学生登录");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("2.老师登录");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("3.管理员登录");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("0.退出");
Print_tail(10);
Print_pdding();
//printf("您好,欢迎使用学生成绩管理系统。\n");
//printf("您想做什么?\n1.学生登录\n2.老师登录\n3.管理员登录\n0.退出\n");
int ck;

ck= scanf("%d", &opt1);
if (ck == 1) {
switch (opt1) {
case 1: {//stulogin
cls;
if (time(0) < UPDATE) {//维护中
printf("系统维护中,除管理员外均无法登录系统。");
sl(3000);
goto bbegin;
}
cls;
Print_pdding();
printf("请输入您的账号,也就是您的学号:");
scanf("%d", &opt1);
Print_pdding();
printf("请输入您的密码,默认是学号后六位:");
scanf("%s", arr);
stu* aax = checkstu(opt2, arr, opt1, stuhead);
if (opt2 == 1) {//登录成功
time(&timer);//将谁登录写入历史
info = localtime(&timer);
fprintf(his, "\n%s学生%s登录", asctime(info), aax->name);
stubegin:cls;
for (choose* aa = aax->first; aa != NULL; aa = aa->next) {
if (aa->tar->notic == 1) {
Print_pdding();
for (int i = 0; i < length; ++i)
printf("━");
printf("\n");
Print_pdding();
printf("来自 %s 的通知:\n", aa->tar->name);
Print_pdding();
printf("%s\n", aa->tar->notice);
Print_pdding();
for (int i = 0; i < length; ++i)
printf("━");
}
}

char* name1;
name1 = (char*)malloc(100 * sizeof(char));
strcpy(name1, aax->name);
const char* a = { "您好,您接下来的操作是:" };
strcat(name1, a);
Print_head();
Print_line();
Print_first(name1);
for (int i = 0; i < 2; i++)
Print_line();
Print_text("1.查询成绩及排名");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("2.申请奖项认证");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("3.修改密码");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("4.退出登录");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("0.退出系统");
Print_tail(5);
Print_pdding();
free(name1);
ck = scanf("%d", &opt1);
if (ck == 1) {
switch (opt1) {//学生的选项
case 1: {
chengji:
cls;
Print_head();
Print_line();
stuperprr(aax);
fprintf(his, "\n%s查看了自己的成绩", aax->name);
printf("\n");
Print_pdding();
printf("您可以选择导出您的成绩至Excel表格中。\n");
printf("\n");
Print_pdding();
printf("1.导出.csv\n");
printf("\n");
Print_pdding();
printf("2.学习状况评估\n");
printf("\n");
Print_pdding();
printf("O.返回上一级\n");
Print_pdding();

ck = scanf("%d", &opt1);
if (ck == 1) {
if (opt1 == 1) {
stupercsvprr(aax);
printf("导出成功,请注意程序非正常结束是不会有文件留下的哦!!!");
fprintf(his, "并导出了");
sl(2000);
goto chengji;
}
else if (opt1 == 2) {
cls;
Learning_state();
sl(2000);
goto chengji;
}
else if (opt1 == 0) {
goto stubegin;
}
else {
Print_pdding();
printf("操作数无效。自动返回上一级。\n");
sl(2000);
goto chengji;
}

}
else
{
Print_pdding();
printf("输入不合法,请重新输入!");
scanf("%*s");
sl(2000);
goto chengji;
}
}
case 2: {
cls;
jingupper* ghj = (jingupper*)malloc(sizeof(jingupper));
teacher* tmp;
strcpy(ghj->ownername, aax->name);
ghj->xh = aax->xh;
Print_pdding();
printf("请输入您希望得到认证的奖项名称或者论文名称,方便查验:\n");
Print_pdding();
scanf("%s", ghj->name);
Print_pdding();
printf("有什么备注吗?获奖序列号或者方便认证的文字:\n");
Print_pdding();
scanf("%s", ghj->ppin);
Print_pdding();
printf("获得了几等奖?请输入数字,如:一等奖->1\n");
Print_pdding();
scanf("%d", &ghj->num);
ss10:
teaprr(teahead);
int ff = 1;
Print_pdding();
printf("您好,请输入您想选择的奖项认证老师前面的数字:\n");
Print_pdding();
scanf("%d", &ff);//特判不合法情况,注意
tmp = teasearch2(ff, teahead);
if (tmp == NULL) {
Print_pdding();
printf("您的输入不合法,请重新输入。");
sl(2000);
cls;
goto ss10;
}
ghj->next = tmp->first;
tmp->first = ghj;
cls;
Print_pdding();
printf("奖项申请成功!指定的老师会审核您的申请。\n");
Print_pdding();
printf("即将返回上级菜单...\n");
sl(2000);
fprintf(his, "\n%s申请了奖项认证:\n%s %s", aax->name, ghj->name, ghj->ppin);//历史
goto stubegin; break;
}
case 3: {
cls;
char buf[40], obuf[40];
rep1:
memset(buf, 0, sizeof(buf));
memset(obuf, 0, sizeof(obuf));//密,密码过长咋办???
Print_pdding();
printf("请输入您的新密码:\n");//数字啊字符判定啊啥的,还能凹,但是没啥必要
Print_pdding();
scanf("%s", buf);//密码输出出来变星号啊啥的,还能凹,但是我不会了
if (strlen(buf) < 10) {
Print_pdding();
printf("您的密码长度小于10,安全性不强,请重新设定。\n");
goto rep1;
}
Print_pdding();
printf("请再输一遍保证密码正确:\n");
Print_pdding();
scanf("%s", obuf);
if (strcmp(buf, obuf) != 0) {
Print_pdding();
printf("两次密码不一致,请重新设置密码!\n");
Sleep(2000);
system("cls");
goto rep1;
}
fprintf(his, "\n%s修改了他的密码:\n%s变动为%s", aax->name, aax->pas, buf);//历史
strcpy(aax->pas, buf);
Print_pdding();
printf("新密码应用成功!\n");
sl(3000);
cls;
goto stubegin; break;
}
case 4: {
fprintf(his, "\n%s退出了登录", aax->name);
goto bbegin; break;
}
case 0: {
fprintf(his, "\n%s退出了登录", aax->name);
goto eend; break;
}
default: {
Print_pdding();
printf("输入不合法,请重新输入!");
goto stubegin; break;
}
}
}
else {
Print_pdding();
printf("输入不合法,请重新输入!");
scanf("%*s");
sl(2000);
goto stubegin;
}
}
else if (opt2 == 0) {
Print_pdding();
printf("密码错误,登录失败!自动返回上一级。\n");
sl(2000);
goto bbegin;
}
else {
Print_pdding();
printf("查无此人,登录失败,自动返回上一级。\n");
sl(2000);
goto bbegin;
}
break;
}
case 2: {//tealogin
cls;
if (time(0) < UPDATE) {//维护中
printf("系统维护中,除管理员外均无法登录系统。");
sl(3000);
goto bbegin;
}
Print_pdding();
printf("请输入您的账号,也就是您的工号:\n");
Print_pdding();
scanf("%d", &opt1);
Print_pdding();
printf("请输入您的密码,默认是工号后六位:\n");
Print_pdding();
scanf("%s", arr);
teacher* bbx = checktea(opt2, opt1, arr, teahead);
if (opt2 == 1) {//登录成功
time(&timer);//将谁登录写入历史
info = localtime(&timer);
fprintf(his, "\n%s老师%s登录", asctime(info), bbx->name);
teabegin:
cls;

char* name2;
name2 = (char*)malloc(100 * sizeof(char));
strcpy(name2, bbx->name);
const char* a = { "您好,您接下来的操作是:" };
strcat(name2, a);
Print_head();
Print_line();
Print_first(name2);
for (int i = 0; i < 2; i++)
Print_line();
Print_text("1.查找学生");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("2.分析学生成绩");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("3.受理奖项认证");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("4.调整绩点算法");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("5.添加新学生");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("6.修改密码");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("7.查看学生成绩");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("8.管理课程");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("9.退出登录");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("0.退出系统");
Print_tail(3);
Print_pdding();
free(name2);
ck = scanf("%d", &opt1);
if (ck == 1) {
switch (opt1) {//老师的选项
case 1: {
rep15:
cls;
Print_head();
Print_line();
Print_text("请输入您想查询的项目:");
Print_line();
Print_text("1.查找学号");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("2.查找姓名(可能返回多人)");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("0.返回上一级");
Print_tail(6);
Print_pdding();
ck=scanf("%d", &opt2);
stu* tmp = NULL;
if (ck == 1) {
switch (opt2) {
case 1: {
cls;
Print_pdding();
printf("请输入目标学号:\n");
Print_pdding();
scanf("%d", &opt1);
tmp = stusearch2(opt1, stuhead);
if (tmp != NULL)
break;
else {
Print_pdding();
printf("查无此人!请重新输入!\n");
scanf("%*s");
sl(2000);
cls;
goto rep15;
}
}
case 2: {
cls;
char buf[40];
Print_pdding();
printf("请输入目标姓名:\n");
Print_pdding();
scanf("%s", buf);
tmp = stusearch1(buf, stuhead);
while (tmp != NULL) {
opt2 = 1;
cls;
Print_head();
Print_line();
char* name0;
name0 = (char*)malloc(100 * sizeof(char));
strcpy(name0, tmp->name);
char* xh0;
xh0 = (char*)malloc(100 * sizeof(char));
xh0 = intToString(tmp->xh);
const char* a = { "您找到了这个学生:" };
Print_first(a);
Print_line();
const char* b = { " 学号:" };
strcat(name0, b);
strcat(name0, xh0);
Print_first(name0);
free(name0);
free(xh0);
Print_line();
//printf("%s %d\n",tmp->name,tmp->xh);
Print_first("这个人是您要找的吗?");
Print_line();
Print_text("1.是");
Print_line();
Print_text("0.不是");
Print_line();
Print_tail(5);
//printf("\n这个人是您要找的吗?\n1.是\n0.不是");
Print_pdding();
scanf("%d", &opt1);
if (opt1 == 1)break;
else tmp = stusearch1(buf, tmp->next);
}
if (tmp == NULL) {
Print_pdding();
printf("查无此人!请重新输入。\n");
scanf("%*s");
sl(2000);
cls;
goto rep15;
}
break;
}
case 0: {
goto teabegin;
}
default: {
Print_pdding();
printf("操作数无效,请重新输入。");
goto rep15;
}
}
}
else {
Print_pdding();
printf("输入不合法,请重新输入!");
scanf("%*s");
sl(2000);
goto rep15;
}
cls;
rep18:
cls;
//stuperprr(tmp);
fprintf(his, "\n%s老师查询了%s", bbx->name, tmp->name);
char* name1;
name1 = (char*)malloc(100 * sizeof(char));
strcpy(name1, tmp->name);
const char* a = { "学生姓名:" };
const char* str = concatenateStrings(a, name1);
Print_head();
Print_line();
Print_first(str);
Print_line();
Print_first("您接下来的操作是:");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("1.改Ta的密码");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("2.撤销奖项");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("3.添加奖项");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("4.删除该学生");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("5.查看该学生成绩");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("0.返回上一级");
Print_tail(3);
Print_pdding();
free(name1);
ck = scanf("%d", &opt1);
if (ck == 1) {
switch (opt1) {
case 1: {
char buf[40], obuf[40];
rep17:
cls;
printf("\n");
Print_pdding();
printf("Ta原先的密码是:%s\n", tmp->pas);
printf("\n");
Print_pdding();
printf("请修改Ta的新密码:");
scanf("%s", buf);//密码输出出来变星号啊啥的,还能凹,但是我不会了
if (strlen(buf) < 10) {
Print_pdding();
printf("您的密码长度小于10,安全性不强,请重新设定。\n");
sl(1000);
goto rep17;
}
Print_pdding();//here
printf("请再输一遍保证密码正确:");
scanf("%s", obuf);
if (strcmp(buf, obuf) != 0) {
Print_pdding();
printf("两次密码不一致,请重新设置密码!\n");
Sleep(2000);
goto rep17;
}
fprintf(his, "并将Ta的密码从%s改为%s", tmp->pas, buf);
strcpy(tmp->pas, buf);
Print_pdding();
printf("新密码应用成功!");
sl(2000);
goto rep18;
}
case 2: {
chexiao:
if (tmp->ppri != 0) {
cls;
stujingprr(tmp);
Print_pdding();
printf("请输入撤销奖项所对应的标号:");
ck = scanf("%d", &opt2);
if(ck==1){
jingper* kk = tmp->prize;
if (opt2 == 1) {
fprintf(his, "\n%s老师撤销了%s的%s的%d等奖", bbx->name, tmp->name, kk->name, kk->num);
tmp->prize = tmp->prize->next;
free(kk);
}
else {
for (int i = 2; i <= tmp->ppri + 1; ++i) {
if (i == opt2) {
fprintf(his, "\n%s老师撤销了%s的%s的%d等奖", bbx->name, tmp->name, kk->next->name, kk->next->num);
kk->next = kk->next->next;
break;
}
kk = kk->next;
}
}
}
else {
Print_pdding();
printf("输入不合法,请重新输入!");
scanf("%*s");
goto chexiao;
}

rep21:
cls;
Print_pdding();
printf("删除成功!\n");
sl(2000);
stucalc(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
tmp->ppri--;
goto rep18;
}
else {
cls;
Print_pdding();
printf("他没有奖项,删除失败,返回上一级。\n");
sl(2000);
goto rep18;
}
}
case 3: {
tmp->ppri++;
int x;
jingper* rres = (jingper*)malloc(sizeof(jingper));
rres->next = tmp->prize;
tmp->prize = rres;
rrep10:
cls;
printf("\n");
printf("\n");
Print_pdding();
printf("请输入他的获奖种类:\n");
printf("\n");
Print_pdding();
printf("1.竞赛 2.论文\n");
printf("\n");
Print_pdding();
ck = scanf("%d", &x);
if (ck == 1) {
switch (x) {
case 1: {
cls;
jingprr(jinghead);
printf("\n");
Print_pdding();
printf("请按照标号选择目标竞赛:");
scanf("%d", &x);
jing* jkl = jingsearch(x, jinghead);
if (jkl != NULL) {
Print_pdding();
printf("请输入几等奖:");
scanf("%d", &x);
strcpy(rres->name, jkl->name);
rres->flg = 3 - x + ((jkl->ff == 1) ? 5 : 0) + ((jkl->flg == 'A') ? 2 : ((jkl->flg == 'C') ? 0 : 1));
rres->num = x;
cls;
Print_pdding();
printf("奖项认证成功!即将返回上一级...\n");
sl(2000);
fprintf(his, "\n%s老师授予%s %s的%d", arr, tmp->name, rres->name, x);//历史
}
else {
cls;
Print_pdding();
printf("操作数无效。请重新输入。\n");
sl(2000);
goto rrep10;
}
break;
}
case 2: {
cls;
lunwenprr();
printf("\n");
printf("\n");
Print_pdding();
printf("论文分为六档,请输入申请人的论文是第几档:");
scanf("%d", &rres->num);
rres->flg = x + 9;
Print_pdding();
printf("请输入论文名字:");
scanf("%s", rres->name);
Print_pdding();
printf("奖项认证成功。\n");
fprintf(his, "\n%s老师授予%s %s的%d", arr, tmp->name, rres->name, rres->num);//历史
break;
}
default: {
Print_pdding();
printf("操作数无效,请重新输入。");
goto rrep10;
}
stucalc(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
goto rep18;
}
}
else {
Print_pdding();
printf("输入不合法,请重新输入!");
scanf("%*s");
goto rrep10;
}
}
case 4: {
Print_pdding();
printf("删除成功。");
fprintf(his, "\n%s老师删除了一位学生。他的属性如下:", bbx->name);
fstuperprr(tmp);
delstu(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
sl(2000);
goto rep18;
}
case 5: {
cls;
Print_head();
Print_line();
stuperprr(tmp);
fprintf(his, "\n%s老师查看了%s的成绩", bbx->name, tmp->name);
Print_pdding();
printf("您可以选择导出您的成绩至Excel表格中。\n");
printf("\n");
Print_pdding();
printf("1.导出.csv\n");
printf("\n");
Print_pdding();
printf("O.返回上一级\n");
Print_pdding();
ck=scanf("%d", &opt1);
if (ck == 1) {
if (opt1 == 1) {
stupercsvprr(tmp);
Print_pdding();
printf("导出成功,请注意程序非正常结束是不会有文件留下的哦!!!");
fprintf(his, "并导出了");
sl(2000);
}
goto rep18;
}
else {
Print_pdding();
printf("输入不合法,请重新输入!");
scanf("%*s");
sl(2000);
goto rep18;
}

break;
}
case 0: {
goto teabegin;
}
default: {
Print_pdding();
printf("操作数无效。自动返回上一级。\n");
sl(2000);
goto teabegin;
}
}
goto teabegin;
}
else {
Print_pdding();
printf("输入不合法,请重新输入!");
scanf("%*s");
sl(2000);
goto rep18;
}
}
case 2: {//只因器学习我不会
Gradeprdict();
sl(2000);
goto teabegin;
}
case 3: {
cls;
if (bbx->first == NULL) {
printf("您没有认证申请了。\n");
}
else {
jingupper* tttmp = bbx->first;
while (tttmp != NULL) {
sss5:
Print_head();
Print_line();
Print_first("您有奖项申请。各项数据如下:");
Print_line();
char* name3;
name3 = (char*)malloc(100 * sizeof(char));
strcpy(name3, tttmp->ownername);
const char* a = { "申请人: " };
a = concatenateStrings(a, name3);
Print_first(a);
Print_line();
char* name4;
name4 = (char*)malloc(100 * sizeof(char));
strcpy(name4, tttmp->name);
const char* b = { "申请奖项: " };
b = concatenateStrings(b, name4);
Print_first(b);
Print_line();
char* name5;
name5 = (char*)malloc(100 * sizeof(char));
strcpy(name5, tttmp->ppin);
const char* c = { "备注: " };
c = concatenateStrings(c, name5);
Print_first(c);
Print_line();
char* str = (char*)malloc(100 * sizeof(char));
str = intToString(tttmp->num);
const char* d = { "奖项等级: " };
d = concatenateStrings(d, str);
Print_first(d);
Print_line();
free(name3);
free(name4);
free(name5);
free(str);
Print_tail(5);
//printf("申请人:%s 学号%d 申请奖项:%s 备注:%s 申请几等奖:%d\n",tttmp->ownername,tttmp->xh,tttmp->name,tttmp->ppin,tttmp->num);
Print_pdding();
printf("是否确有此奖项?请认真核对并输入1是0没有:\n");
int opt = 0;
Print_pdding();
ck=scanf("%d", &opt);
if (ck == 1) {
printf("\n");
if (opt == 1) {
Print_pdding();
printf("它是论文吗?1是0不是:\n");
Print_pdding();
scanf("%d", &opt);
if (opt == 1) {//学生认证环节,
rz:
cls;
lunwenprr();
printf("\n");
Print_pdding();
printf("论文分为六档,申请人的论文是:");
jingper* res = (jingper*)malloc(sizeof(jingper));
ck = scanf("%d", &opt);
if (ck == 1)
{
res->flg = opt + 9;
strcpy(res->name, tttmp->name);
res->num = tttmp->num;
stu* aax = stusearch2(tttmp->xh, stuhead);
res->next = aax->prize;
aax->prize = res;
cls;
Print_pdding();
printf("奖项认证成功,下一项\n");
sl(2000);
cls;
aax->ppri++;
stucalc(aax);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
//recalc~~~
}
else {
Print_pdding();
printf("操作数无效。请重新输入。\n");
scanf("%*s");
sl(2000);
cls;
goto rz;
}
}
else {
if (opt == 0) {
mubiao:
cls;
jingprr(jinghead);
Print_pdding();
printf("请按照标号选择目标竞赛:");
ck = scanf("%d", &opt);
if (ck == 1) {
jing* jkl = jingsearch(opt, jinghead);
if (jkl != NULL) {
//学生认证环节
stu* aax = stusearch2(tttmp->xh, stuhead);
jingper* rres = (jingper*)malloc(sizeof(jingper));
strcpy(rres->name, jkl->name);
rres->flg = 3 - tttmp->num + ((jkl->ff == 1) ? 5 : 0) + ((jkl->flg == 'A') ? 2 : ((jkl->flg == 'C') ? 0 : 1));

rres->num = tttmp->num;

rres->next = aax->prize;
aax->prize = rres;
cls;
Print_pdding();
printf("奖项认证成功,下一项\n");
sl(2000);
cls;
aax->ppri++;
stucalc(aax);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
fprintf(his, "\n%s老师接受了%s的认证,并同意了。", bbx->name, aax->name);//历史
}
else {
Print_pdding();
printf("操作数无效。请重新输入。\n");
sl(2000);
cls;
goto sss5;
}
}
else {
Print_pdding();
printf("操作数无效。请重新输入。\n");
scanf("%*s");
sl(2000);
cls;
goto mubiao;
}
}
else {
Print_pdding();
printf("操作数无效。请重新输入。\n");
sl(2000);
cls;
goto sss5;
}
}
}
else {
if (opt == 0) {
Print_pdding();
printf("奖项已否决。\n");
sl(2000);
cls;
fprintf(his, "\n%s老师否决了%s的认证。", bbx->name, tttmp->ownername);//历史
}
else {
Print_pdding();
printf("操作数无效,请重新输入。");
goto sss5;
}
}
tttmp = tttmp->next;
free(bbx->first);
bbx->first = tttmp;
}
else {
Print_pdding();
printf("操作数无效。请重新输入。\n");
scanf("%*s");
sl(2000);
cls;
goto sss5;
}

}
}
cls;
printf("辛苦老师了,没有奖项认证的申请了哦\n");
Sleep(3000);
system("cls");
goto teabegin;
}
case 4: {
cls;
Print_head();
Print_line();
Print_text("您想修改哪个绩点计算方式?");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("1.成绩绩点算法");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("2.竞赛绩点算法");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("3.论文及学术著作的绩点算法");
Print_line();
Print_tail(5);
Print_pdding();
scanf("%d", &opt2);
switch (opt2) {
case 1: {
cls;
printf("\n");
printf("\n");
Print_pdding();
for (int i = 0; i < length; i++) {
printf("=");
}
printf("\n");
printf("\n");
for (int i = 1; i < 14; ++i) {
Print_pdding();
printf("%d:%d至%d分数段对应绩点:%.1f\n", i, point[i - 1] - 1, point[i], jidian[i]);
}
printf("\n");
Print_pdding();
for (int i = 0; i < length; i++) {
printf("=");
}
printf("\n");
Print_pdding();
printf("本系统绩点算法目前为分段制,分13段,每段绩点如上,请输入您想修改的部分:");
int opt, oopt;
float ooopt;
scanf("%d", &opt);
if (opt <= 0 || opt > 13) {
printf("绩点修改失败,段不存在,返回上一级。\n");
cls;
goto teabegin;
}
printf("\n");
Print_pdding();
printf("您想修改为多少?请对后段进行修改,先输入0-100的数字\n");
Print_pdding();
printf("再输入对应绩点(注意程序绩点计算从高到低依次进行计算):\n");
Print_pdding();
scanf("%d", &oopt);
Print_pdding();
scanf("%f", &ooopt);
point[opt] = oopt; jidian[opt] = ooopt;
Print_pdding();
printf("绩点修改成功,自动返回上一级...\n");
sl(2000);
fprintf(his, "\n%s老师调整了绩点的计算方式,老的绩点算法为:", bbx->name);//历史
for (int i = 1; i < 14; ++i) {
fprintf(his, "\n%d %d %.1f", point[i - 1] - 1, point[i], jidian[i]);
}
fprintf(his, "\n新的为:");
for (int i = 1; i < 14; ++i) {
fprintf(his, "\n%d %d %.1f", point[i - 1] - 1, point[i], jidian[i]);
}

sturecalc(stuhead);//算绩点
stusort(stuhead, cmps31);
getrank(stuhead);//算排名

goto teabegin;
}
case 2: {
float opt3;
cls;
jingsaiprr();
Print_pdding();
printf("本系统的竞赛档次分为五档,您可以更改其中的权重\n");//这里是竞赛的简介
Print_pdding();
printf("当前竞赛绩点加分为:\n");
Print_pdding();
printf("1:%.3f\n", 2 * jingji[6]);
Print_pdding();
printf("2:%.3f \n", 2 * jingji[7]);
Print_pdding();
printf("3:%.3f \n", 2 * jingji[8]);
Print_pdding();
printf("4:%.3f \n", 2 * jingji[9]);
Print_pdding();
printf("5:%.3f\n", 2 * jingji[10]);
printf("\n");
Print_pdding();
printf("请输入想修改的档次和对应的修改后的结果:\n");
Print_pdding();
scanf("%d", &opt1);
Print_pdding();
scanf("%f", &opt3);
if (opt1 <= 0 || opt1 > 5) {
Print_pdding();
printf("对应档次不存在,修改失败,自动返回上一级...");
sl(2000);
goto teabegin;
}
Print_pdding();
printf("修改成功。自动返回上一级...");
fprintf(his, "\n%s调整了竞赛对应的绩点算法,老的绩点竞赛数据为:", bbx->name);
for (int i = 6; i < 11; ++i) {
fprintf(his, "%.3f ", jingji[i]);
}
jingji[opt1 + 5] = opt3 / 2;
fprintf(his, "\n新的绩点竞赛数据为:");
for (int i = 6; i < 11; ++i) {
fprintf(his, "%.3f ", jingji[i]);
}

sturecalc(stuhead);//算绩点
stusort(stuhead, cmps31);
getrank(stuhead);//算排名

goto teabegin;
}
case 3: {
float opt3;
cls;
lunwenprr();
printf("\n");
Print_pdding();
printf("本系统的论文档次分为六档,您可以更改其中的权重。\n");
Print_pdding();
printf("当前竞赛绩点加分为: \n");
Print_pdding();
printf("1: %.3f\n", jingji[0]);
Print_pdding();
printf("2: %.3f\n", jingji[1]);
Print_pdding();
printf("3: %.3f\n", jingji[2]);
Print_pdding();
printf("4: %.3f\n", jingji[3]);
Print_pdding();
printf("5: %.3f\n", jingji[4]);
Print_pdding();
printf("6: %.3f\n", jingji[5]);
Print_pdding();
printf("请输入想修改的档次和对应的修改后的结果:\n");
Print_pdding();
scanf("%d", &opt1);
Print_pdding();
scanf("%f", &opt3);
if (opt1 <= 0 || opt1 > 6) {
Print_pdding();
printf("对应档次不存在,修改失败,自动返回上一级...");
sl(2000);
goto teabegin;
}
Print_pdding();
printf("修改成功。自动返回上一级...");
fprintf(his, "\n%s调整了论文对应的绩点算法,老的论文绩点数据为:", bbx->name);
for (int i = 0; i < 6; ++i) {
fprintf(his, "%.3f ", jingji[i]);
}
jingji[opt1 - 1] = opt3;
fprintf(his, "\n新的论文绩点数据为:");
for (int i = 0; i < 6; ++i) {
fprintf(his, "%.3f ", jingji[i]);
}

sturecalc(stuhead);//算绩点
stusort(stuhead, cmps41);
getrank(stuhead);//算排名

goto teabegin;
}
default: {
printf("输入不合法。绩点调整失败,返回上一级...");
sl(2000);
goto teabegin;
}
}
goto teabegin;
break;
}
case 5: {
newstu(bbx->name);
fprintf(his, "\n%s老师添加了新学生", bbx->name);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
goto teabegin;
}
case 6: {
char buf[40], obuf[40];
rep2:
cls;
memset(buf, 0, sizeof(buf));
memset(obuf, 0, sizeof(obuf));//密,密码过长咋办???
Print_pdding();
printf("请输入您的新密码:\n");//数字啊字符判定啊啥的,还能凹,但是没啥必要
Print_pdding();
scanf("%s", buf);//密码输出出来变星号啊啥的,还能凹,但是我不会了
if (strlen(buf) < 10) {
Print_pdding();
printf("您的密码长度小于10,安全性不强,请重新设定。\n");
sl(2000);
goto rep2;
}
Print_pdding();
printf("请再输一遍保证密码正确:\n");
Print_pdding();
scanf("%s", obuf);
if (strcmp(buf, obuf) != 0) {
Print_pdding();
printf("两次密码不一致,请重新设置密码!\n");
Sleep(2000);
system("cls");
goto rep2;
}
fprintf(his, "\n%s修改了他的密码:\n%s变动为%s", bbx->name, bbx->pas, buf);//历史
strcpy(bbx->pas, buf);
printf("新密码应用成功!\n");
sl(3000);
cls;
goto teabegin;
break;
}
case 9: {
fprintf(his, "\n%s退出了登录", bbx->name);
goto bbegin;
}
case 8: {
if (bbx->tn != 0) {
rep11:
cls;
Print_head();
Print_line();
Print_first("您目前所教课程都有:");
Print_line();
teacouprr(bbx);
Print_pdding();
printf("请输入课程前面的序号以对其进行操作:");
scanf("%d", &opt1);


choose* ttmp = bbx->teach;
Course* tmp = NULL;

for (int i = 1; ttmp != NULL; ++i) {
if (i == opt1) {
tmp = ttmp->tar;
break;
}
ttmp = ttmp->next;
}
//Course *tmp=cousearch1(couhead,opt1);
if (tmp != NULL) {//课程,大界面
fprintf(his, "\n%s老师管理了%s课程:", bbx->name, tmp->name);
classbegin:
cls;
Print_head();
Print_line();
Print_text("1.查看同学成绩");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("2.更改平时分考试分比例");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("3.发布通知");
for (int i = 0; i < 2; i++)
Print_line();
//
Print_text("4.撤销通知");
for (int i = 0; i < 2; i++)
Print_line();
//
Print_text("0.返回上一级");
Print_tail(5);
Print_pdding();
printf("当前平时分考试分比例为%d:%d\n", tmp->Daily, tmp->Text);
printf("\n");
Print_pdding();
printf("请输入您想对 %s 课程进行的操作:", tmp->name);
scanf("%d", &opt1);
switch (opt1) {
case 1: {
rep16:
cls;
coustuprr(tmp);
printf("\n");
Print_pdding();
printf("请输入您想进行的操作:\n");
Print_pdding();
printf("1.更改学生成绩\n");
Print_pdding();
printf("2.导出学生成绩\n");
Print_pdding();
printf("3.排序后再看学生成绩\n");
Print_pdding();
printf("0.返回上一级\n");
Print_pdding();
scanf("%d", &opt1);
switch (opt1) {
case 1: {
printf("\n");
Print_pdding();
printf("请输入修改对象的序号:");
scanf("%d", &opt1);
if (opt1 <= tmp->top && opt1 > 0) {//修改
float opt10;
Print_pdding();
printf("请输入修改后的平时分:");
scanf("%f", &opt10);
if (opt10 <= 100 && opt10 >= 0) {
tmp->stu[opt1].daily = opt10;
}
else {
Print_pdding();
printf("输入不合法,成绩将保持不变。\n");//我觉得这很合理啊,你是老师,不想改学生平时分想改考试分但是记不住,就只能卡评测。
}
Print_pdding();
printf("请输入修改后的考试分:");
scanf("%f", &opt10);
if (opt10 <= 100 && opt10 >= 0) {
tmp->stu[opt1].text = opt10;
}
else {
Print_pdding();
printf("输入不合法,成绩将保持不变。\n");//我觉得这很合理啊,你是老师,不想改学生平时分想改考试分但是记不住,就只能卡评测。
}
fprintf(his, "修改%s的成绩为 %.1f %.1f", tmp->stu[opt1].name, tmp->stu[opt1].daily, tmp->stu[opt1].text);
tmp->stu[opt1].final = (tmp->stu[opt1].daily * tmp->Daily + tmp->stu[opt1].text * tmp->Text) / 100;
stucalc(stusearch2(tmp->stu[opt1].id, stuhead));
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);

}
else {
Print_pdding();
printf("操作数无效,返回上一级...");
sl(2000);
goto classbegin;
}
Print_pdding();
printf("修改成功!\n");
sl(2000);
goto rep16;
}
case 2: {
coupercsvprr(tmp);
Print_pdding();
printf("成功导出。温馨提示,程序非正常关闭不会有文件留下。");
fprintf(his, "\n%s老师导出了%s的成绩", bbx->name, tmp->name);
sl(2000);
goto rep16;
}
case 3: {
back:
cls;
coustuprr(tmp);
Print_pdding();
printf("请输入您想查看的模式:\n");
Print_pdding();
printf("1.按照成绩降序排列\n");
Print_pdding();
printf("2.按照成绩升序排列\n");
Print_pdding();
printf("3.按班降序排列\n");
Print_pdding();
printf("4.按班升序排列\n");
Print_pdding();
printf("5.对平时分降序排列\n");
Print_pdding();
printf("6.对平时分升序排列\n");
Print_pdding();
printf("7.对考试成绩降序排列\n");
Print_pdding();
printf("8.对考试成绩升序排列\n");
Print_pdding();
scanf("%d", &opt1);
switch (opt1) {//写排序函数。
case 1:coursort(tmp, cmpc11); break;
case 2:coursort(tmp, cmpc12); break;
case 3:coursort(tmp, cmpc21); break;
case 4:coursort(tmp, cmpc22); break;
case 5:coursort(tmp, cmpc31); break;
case 6:coursort(tmp, cmpc32); break;
case 7:coursort(tmp, cmpc41); break;
case 8:coursort(tmp, cmpc42); break;
default: {
printf("输入有误,请重新输入!");
sl(2000);
goto back;
}
}
goto rep16;
}
case 0: {
goto classbegin;
}
default: {
printf("输入有误,请重新输入!");
sl(2000);
goto rep16;
}
}
goto rep11;
}
case 2: {
Print_pdding();
printf("请输入新的平时分和考试分的整数百分比例,并保持平时分加考试分和为100:\n");
Print_pdding();
scanf("%d", &opt1);
Print_pdding();
scanf("%d", &opt2);
if (opt1 + opt2 != 100 || (opt1 < 0 || opt1>100)) {
Print_pdding();
printf("输入不合法,比例将保持不变。");
sl(2000);
cls;
goto classbegin;
}
tmp->Daily = opt1; tmp->Text = opt2;
Print_pdding();
printf("更改成功!\n");
fprintf(his, "%s调整了课程平时分考试分计算比例 %d %d", bbx->name, opt1, opt2);
courperrecalc(tmp);
sturecalc(stuhead);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
sl(2000);
goto rep11;
}
case 3: {
Print_pdding();
printf("您只能在该课程中同时发布一条重要通知,学生登录后在界面可以看到它。\n");
Print_pdding();
printf("请输入您的通知:\n");
Print_pdding();
scanf("%s", tmp->notice);
tmp->notic = 1;
fprintf(his, "\n%s老师发布了通知:\n%s", bbx->name, tmp->notice);
Print_pdding();
printf("通知发布成功!");
sl(2000);
goto classbegin;
}
//
case 4: {//我不会排版,您等大佬加油!
rep353:cls;
Print_pdding();
if (tmp->notic == 1) {
printf("当前通知为:%s\n", tmp->notice);
Print_pdding();
printf("确认撤销?1是0保留:\n");
Print_pdding();
scanf("%d", &opt2);
if (opt2 == 1) {
tmp->notic = 0;
fprintf(his, "\n%s老师撤销了通知:\n%s", bbx->name, tmp->notice);
Print_pdding();
printf("通知撤销成功!");
sl(2000);
}
else {
if (opt2 == 0) {
printf("通知已保留。");
sl(2000);
}
else {
printf("操作数无效,请重新输入。\n");
goto rep353;
}
}
}
else {
printf("该课程没有发布通知。自动返回上一级。\n");
sl(2000);
}
goto classbegin;
}
//
case 0: {
goto teabegin;
}
default: {
printf("输入有误,请重新输入!");
sl(2000);
goto rep11;
}
}
//结束课程操作
}
else {
Print_pdding();
printf("输入有误,请重新输入。");
sl(2000);
cls;
goto rep11;
}
}
else {
Print_pdding();
printf("您没有教的课程。自动返回上一级...");
sl(2000);
}
goto teabegin;
}
case 7: {
rep34:
cls;
stuprr(stuhead);
Print_pdding();
printf("请选择您想查看的模式:\n");
Print_pdding();
printf("1.按照推免规则降序\n");
Print_pdding();
printf("2.按照平均绩点降序\n");
Print_pdding();
printf("3.按照班级排序,班内按照推免规则降序\n");
Print_pdding();
printf("4.按照班级排序,班内按平均绩点降序\n");
Print_pdding();
printf("5.按照学号排序\n");
Print_pdding();
printf("6.导出所有学生成绩\n");
Print_pdding();
printf("0.返回上一级\n");
Print_pdding();
scanf("%d", &opt1);
switch (opt1) {
case 1: {
stuhead = stusort(stuhead, cmps31);
break;
}
case 2: {
stuhead = stusort(stuhead, cmps41);
break;
}
case 3: {
stuhead = stusort(stuhead, cmps22);
break;
}
case 4: {
stuhead = stusort(stuhead, cmps21);
break;
}
case 5: {
stuhead = stusort(stuhead, cmps10);
break;
}
case 6: {
stucsvprr(stuhead);
printf("导出成功!");
sl(2000);
}
case 0: {
goto teabegin;
}
}
goto rep34;
}
case 0: {
fprintf(his, "\n%s退出了登录", bbx->name);
goto eend;
}
default: {
Print_pdding();
printf("输入不合法,请重新输入。");
sl(2000);
goto teabegin;
break;
}
}
}
else {
Print_pdding();
printf("输入有误!请重新输入!");
scanf("%*s");
sl(2000);
goto teabegin;
}
}
else if (opt2 == 0) {
printf("密码错误,登录失败,自动返回上一级。\n");
sl(2000);
goto bbegin;
}
else {
Print_pdding();
printf("查无此人,登录失败,自动返回上一级。\n");
sl(2000);
goto bbegin;
}
break;
}
case 3: {
cls;
unsigned long long ko = 0;
Print_pdding();
printf("请输入您的账号:\n");
Print_pdding();
scanf("%llu", &ko);
Print_pdding();
printf("请输入您的密码:\n");
Print_pdding();
scanf("%s", arr);
adm* ccx = checkadm(opt2, ko, arr, admhead);
if (opt2 == 1) {//登录成功
time(&timer);//将谁登录写入历史
info = localtime(&timer);
fprintf(his, "\n%s管理员%s登录", asctime(info), ccx->name);
admbegin:
cls;
char* name3;
name3 = (char*)malloc(100 * sizeof(char));
strcpy(name3, ccx->name);
const char* a = { "管理员: " };
a = concatenateStrings(a, name3);
a = concatenateStrings(a, " 您好!");
Print_head();
Print_line();
Print_first(a);
Print_line();
Print_text("1.管理学生");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("2.管理老师");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("3.管理课程");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("4.修改密码");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("5.设定系统维护时间");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("6.调整竞赛等级");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("7.退出登录");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("0.退出系统");




Print_tail(5);
Print_pdding();
free(name3);
ck=scanf("%d", &opt1);
if(ck==1){
switch (opt1) {//管理员的选项
case 1: {
rep2233:
cls;
stuprr(stuhead);
Print_pdding();
printf("输入序号以对其进行管理:");
scanf("%d", &opt1);
stu* tmp = stusearch3(opt1, stuhead);
if (tmp == NULL) {
printf("非法输入,请重新输入!\n");
sl(2000);
goto rep2233;
}
rep88:
cls;
Print_head();
Print_line();
stuperprr(tmp);
fprintf(his, "\n管理员%s查询了%s", ccx->name, tmp->name);
char* name1;
name1 = (char*)malloc(100 * sizeof(char));
strcpy(name1, tmp->name);
const char* a = { "学生姓名:" };
const char* str = concatenateStrings(a, name1);
Print_head();
Print_line();
Print_first(str);
Print_line();
Print_first("您接下来的操作是:");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("1.改Ta的密码");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("2.撤销奖项");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("3.添加奖项");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("4.删除该学生");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("5.管理Ta的选课");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("6.添加选课");
for (int i = 0; i < 2; i++)
Print_line();
Print_text("0.返回上一级");
Print_tail(3);
Print_pdding();
free(name1);
ck==scanf("%d", &opt1);
if (ck == 1) {
switch (opt1) {
case 1: {
char buf[40], obuf[40];
rep77:
cls;
printf("\n");
Print_pdding();
printf("Ta原先的密码是:%s\n", tmp->pas);
printf("\n");
Print_pdding();
printf("请修改Ta的新密码:");
scanf("%s", buf);//密码输出出来变星号啊啥的,还能凹,但是我不会了
if (strlen(buf) < 10) {
Print_pdding();
printf("您的密码长度小于10,安全性不强,请重新设定。\n");
sl(1000);
goto rep77;
}
cls;
Print_pdding();
printf("请再输一遍保证密码正确:");
scanf("%s", obuf);
if (strcmp(buf, obuf) != 0) {
Print_pdding();
printf("两次密码不一致,请重新设置密码!\n");
Sleep(2000);
goto rep77;
}
fprintf(his, "并将Ta的密码从%s改为%s", tmp->pas, buf);
strcpy(tmp->pas, buf);
Print_pdding();
printf("新密码应用成功!");
sl(2000);
goto rep88;
}
case 2: {
cls;
if (tmp->ppri != 0) {
stujingprr(tmp);
Print_pdding();
printf("请输入撤销奖项所对应的标号:");
scanf("%d", &opt2);
jingper* kk = tmp->prize;
if (opt2 == 1) {
tmp->prize = tmp->prize->next;
free(kk);
}
else {
for (int i = 2; i <= tmp->ppri + 1; ++i) {
if (i == opt2) {
fprintf(his, "\n%s老师撤销了%s的%s的%d等奖", ccx->name, tmp->name, kk->next->name, kk->next->num);
kk->next = kk->next->next;
break;
}
kk = kk->next;
}
}
Print_pdding();
printf("删除成功!\n");
tmp->ppri--;

stucalc(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
sl(2000);
goto rep88;
}
else {
cls;
Print_pdding();
printf("他没有奖项,删除失败,返回上一级。\n");
sl(2000);
goto rep88;
}
}
case 3: {
tmp->ppri++;
int x;
jingper* rres = (jingper*)malloc(sizeof(jingper));
rres->next = tmp->prize;
tmp->prize = rres;
rrep18:
cls;
printf("\n");
printf("\n");
Print_pdding();
printf("请输入他的获奖种类:\n");
printf("\n");
Print_pdding();
printf("1.竞赛 2.论文\n");
printf("\n");
Print_pdding();
scanf("%d", &x);
switch (x) {
case 1: {
cls;
jingprr(jinghead);
printf("\n");
Print_pdding();
printf("请按照标号选择目标竞赛:");
scanf("%d", &x);
jing* jkl = jingsearch(x, jinghead);
if (jkl != NULL) {
Print_pdding();
printf("请输入几等奖:");
scanf("%d", &x);
if (x > 3 || x < 0) {
printf("输入有误!请重新输入。\n");
sl(2000);
goto rrep18;
}
strcpy(rres->name, jkl->name);
rres->flg = 3 - x + ((jkl->ff == 1) ? 5 : 0) + ((jkl->flg == 'A') ? 2 : ((jkl->flg == 'C') ? 0 : 1));
rres->num = x;
cls;
Print_pdding();
printf("奖项认证成功!即将返回上一级...\n");
sl(2000);
fprintf(his, "\n%s管理员授予%s %s的%d", arr, tmp->name, rres->name, x);//历史
}
else {
cls;
Print_pdding();
printf("输入有误!请重新输入。\n");
sl(2000);
goto rrep18;
}
break;
}
case 2: {
cls;
lunwenprr();
printf("\n");
printf("\n");
Print_pdding();
printf("论文分为六档,请输入申请人的论文是第几档:");
scanf("%d", &rres->num);
rres->flg = x + 9;
Print_pdding();
printf("请输入论文名字:");
scanf("%s", rres->name);
Print_pdding();
printf("奖项认证成功。\n");
sl(2000);
stucalc(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
fprintf(his, "\n%s管理员授予%s %s的%d", arr, tmp->name, rres->name, rres->num);//历史
break;
}
default: {
cls;
Print_pdding();
printf("输入有误!请重新输入。\n");
sl(2000);
goto rrep18;
}
}
stucalc(tmp);
goto rep88;
}
case 4: {
cls;
Print_pdding();
printf("删除成功!\n");
fprintf(his, "\n管理员%s删除了一位学生。他的属性如下:", ccx->name);
fstuperprr(tmp);
delstu(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
sl(2000);
goto admbegin;
}
case 5: {
cls;
opt1 = 1;
float res = 0;
printf("\n");
printf("\n");
Print_pdding();
for (int i = 0; i < length; i++) {
printf("=");
}
printf("\n");
printf("\n");

for (choose* ui = tmp->first; ui != NULL; opt1++, ui = ui->next) {
opt2 = courstusearch1(ui->tar, tmp->xh, res);
Print_pdding();
printf("%d\t%s\t%.1f\t%.1f\t%.1f\n", opt1, ui->tar->name, ui->tar->stu[opt2].daily, ui->tar->stu[opt2].text, res);
printf("\n");
}
printf("\n");
Print_pdding();
for (int i = 0; i < length; i++) {
printf("=");
}
printf("\n");
Print_pdding();
printf("请输入标号以便进行修改:");
scanf("%d", &opt1);
Course* ccou = NULL; int i = 1;
for (choose* kkk = tmp->first; kkk != NULL; kkk = kkk->next, ++i) {
if (i == opt1) {
ccou = kkk->tar;
break;
}
}
//Course * ccou=cousearch1(couhead,opt1);
rep87:
cls;
printf("\n");
Print_pdding();
printf("%s\t%.1\t %.1f\t%.1f\n", ccou->name, ccou->stu[opt2].daily, ccou->stu[opt2].text, res);
Print_head();
Print_line();
Print_text("1.修改成绩");
Print_line();
Print_text("2.删除选课");
Print_line();
Print_text("0.返回上一级");
Print_tail(3);
Print_pdding();
printf("请输入您想对学生指定课程成绩进行的操作:");
scanf("%d", &opt1);
switch (opt1) {
case 1: {
float opt10;
Print_pdding();
printf("请输入修改后的平时分:");
scanf("%f", &opt10);
if (opt10 <= 100 && opt10 >= 0) {
ccou->stu[opt2].daily = opt10;
}
else {
Print_pdding();
printf("输入不合法,成绩将保持不变。\n");//我觉得这很合理啊,你是老师,不想改学生平时分想改考试分但是记不住,就只能卡评测。
}
Print_pdding();
printf("请输入修改后的考试分:");
scanf("%f", &opt10);
if (opt10 <= 100 && opt10 >= 0) {
ccou->stu[opt2].text = opt10;
}
else {
Print_pdding();
printf("输入不合法,成绩将保持不变。\n");//我觉得这很合理啊,你是老师,不想改学生平时分想改考试分但是记不住,就只能卡评测。
}
fprintf(his, "修改%s的成绩为 %.1f %.1f", ccou->stu[opt2].name, ccou->stu[opt2].daily, ccou->stu[opt2].text);
ccou->stu[opt2].final = (ccou->stu[opt2].daily * ccou->Daily + ccou->stu[opt2].text * ccou->Text) / 100;
Print_pdding();
printf("修改成功!\n");
stucalc(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
sl(2000);
goto rep87;
}
case 2: {
Print_pdding();
printf("删除成功。\n");
sl(2000);
ccou->stu[opt2] = ccou->stu[ccou->top];
ccou->top--;
tmp->choo--;
fprintf(his, "\n管理员%s删除了%s的%s选课,成绩 %.1f %.1f", ccx->name, tmp->name, ccou->name, ccou->stu[opt2].daily, ccou->stu[opt2].text);
if (tmp->first->tar == ccou) {
tmp->first = tmp->first->next;
stucalc(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
goto admbegin;
}
for (choose* ko = tmp->first; ko->next != NULL; ko = ko->next) {
if (ko->next->tar == ccou) {
ko->next = ko->next->next;
stucalc(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
break;
}
}
//goto rep87;

goto admbegin;
}
case 0: {
goto admbegin;
}
default: {
Print_pdding();
printf("输入有误,请重新输入。\n");
sl(2000);
cls;
goto rep87;
}
}
}
case 6: {
rep114:cls;
Print_pdding();
printf("请输入你想添加的课程名(注意请不要与原有课程冲突):\n");
char buf[100];
Print_pdding();
scanf("%s", buf);
choose* yu = (choose*)malloc(sizeof(choose));
yu->tar = coursearch1(couhead, buf);
if (yu->tar == NULL) {
Print_pdding();
printf("该课程不存在!请重新输入。\n");
sl(2000);
goto rep114;
}
yu->next = tmp->first;
tmp->first = yu;
yu->tar->top++;

strcpy(yu->tar->stu[yu->tar->top].name, tmp->name);
yu->tar->stu[yu->tar->top].id = tmp->xh;
Print_pdding();
printf("请输入平时分:");
scanf("%f", &yu->tar->stu[yu->tar->top].daily);

Print_pdding();
printf("请输入考试分:");
scanf("%f", &yu->tar->stu[yu->tar->top].text);

yu->tar->stu[yu->tar->top].final = (yu->tar->stu[yu->tar->top].daily * yu->tar->Daily + yu->tar->Text * yu->tar->stu[yu->tar->top].text) / 100;
stucalc(tmp);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);
Print_pdding();
printf("新课程添加成功!");
fprintf(his, "%s添加了%s的新科目%s,并赋值为%f %f", ccx->name, tmp->name, yu->tar->name, yu->tar->stu[yu->tar->top].daily, yu->tar->stu[yu->tar->top].text);
sl(2000);
goto admbegin;
}
case 0: {
goto admbegin;
}
default: {
Print_pdding();
printf("输入有误,请重新输入。\n");
sl(2000);
goto admbegin;
}
}
goto admbegin;
}
else {
Print_pdding();
printf("输入有误,请重新输入。\n");
sl(2000);
scanf("%*s");
goto rep88;
}
}
case 2: {
rep99:
cls;
Print_head();
Print_line();
Print_text("1.查找老师");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("2.添加老师");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("0.返回上一级");
Print_line();
Print_tail(5);
Print_pdding();
printf("您接下来的操作是:");
scanf("%d", &opt2);
switch (opt2) {
case 1: {
cls;
teaprr(teahead);
Print_pdding();
printf("请选择您想查找的老师的序号:");
scanf("%d", &opt2);
teacher* tmp = teasearch2(opt2, teahead);
cls;
char* name1;
name1 = (char*)malloc(100 * sizeof(char));
strcpy(name1, tmp->name);
const char* a = { "老师姓名:" };
const char* str = concatenateStrings(a, name1);
here:
cls;
Print_head();
Print_line();
Print_first(str);
Print_line();
Print_first("您接下来的操作是:");
Print_line();
Print_text("1.添加所教科目");
for (int i = 0; i < 2; ++i)
Print_line();
Print_text("2.删除老师");
for (int i = 0; i < 2; ++i)
Print_line();
Print_text("3.删除所教科目");
for (int i = 0; i < 2; ++i)
Print_line();
Print_text("4.更改老师密码");
for (int i = 0; i < 2; ++i)
Print_line();
Print_text("0.返回上一级");
for (int i = 0; i < 2; ++i)
Print_line();
Print_tail(5);
Print_pdding();
scanf("%d", &opt1);
switch (opt1) {
case 1: {
char arr[100];
cls;
Print_pdding();
printf("请输入课程名称:");
scanf("%s", arr);
choose* rrres = (choose*)malloc(sizeof(choose));
rrres->tar = coursearch1(couhead, arr);
choose* io = tmp->teach;
for (; io != NULL; io = io->next) {
if (io->tar == rrres->tar) {
Print_pdding();
printf("所教课程重合,录入失败。");
sl(2000);
goto admbegin;
}
}
//rrres->next=io->next;
//io->next=rrres;
rrres->next = io;
tmp->teach = rrres;
tmp->tn++;
Print_pdding();
printf("录入成功。\n");
sl(2000);
goto here;
}
case 2: {
if (tmp == teahead) {
fprintf(his, "管理%s删除了%s老师", ccx->name, tmp->name);
teahead = teahead->next;
}
else {
fprintf(his, "管理%s删除了%s老师", ccx->name, tmp->name);
for (teacher* ui = teahead; ui->next != NULL; ui = ui->next) {
if (ui->next == tmp) {
ui->next = ui->next->next;
break;
}
}
}
printf("删除成功。\n");
sl(2000);
goto admbegin;
}
case 3: {
if (tmp->teach == NULL) {
Print_pdding();
printf("未找到Ta的教课程,删除失败。");
sl(2000);
goto rep99;
}
opt1 = 1;
cls;
Print_head();
Print_line();
Print_first("他所教课程有:");
//printf("他所教课程有:\n");
for (choose* ppo = tmp->teach; ppo != NULL; ppo = ppo->next, ++opt1) {
char* name1;
name1 = (char*)malloc(100 * sizeof(char));
strcpy(name1, ppo->tar->name);
char* a = intToString(opt1);
strcat(a, ". ");
const char* str = concatenateStrings(a, name1);
Print_line();
Print_text(str);
free(name1);
//printf("%d %s\n",opt1,ppo->tar->name);
}
Print_tail(2);
Print_pdding();
printf("请选择标号确定课程:");
scanf("%d", &opt1);
if (opt1 == 1) {
fprintf(his, "\n管理员%s删除了%s老师的%s课程授课权限。", ccx->name, tmp->name, tmp->teach->tar);
tmp->teach = tmp->teach->next;
tmp->tn--;
printf("删除成功。\n");
}
opt2 = 2;
for (choose* ppo = tmp->teach; ppo->next != NULL; opt2++, ppo = ppo->next) {
if (opt2 == opt1) {
fprintf(his, "\n管理员%s删除了%s老师的%s课程授课权限。", ccx->name, tmp->name, ppo->next->tar->name);
ppo->next = ppo->next->next;
tmp->tn--;
printf("删除成功。\n");
sl(2000);
goto rep99;
}
}
Print_pdding();
printf("输入有误,删除失败\n");
sl(2000);
goto rep99;
}
case 4: {
char buf[40], obuf[40];
rep76:
cls;
printf("\n");
Print_pdding();
printf("Ta原先的密码是:%s\n", tmp->pas);
printf("\n");
Print_pdding();
printf("请修改Ta的新密码:");
scanf("%s", buf);//密码输出出来变星号啊啥的,还能凹,但是我不会了
if (strlen(buf) < 10) {
Print_pdding();
printf("您的密码长度小于10,安全性不强,请重新设定。\n");
sl(1000);
goto rep76;
}
Print_pdding();
printf("请再输一遍保证密码正确:");
scanf("%s", obuf);
if (strcmp(buf, obuf) != 0) {
Print_pdding();
printf("两次密码不一致,请重新设置密码!\n");
Sleep(2000);
goto rep76;
}
fprintf(his, "并将Ta的密码从%s改为%s", tmp->pas, buf);
strcpy(tmp->pas, buf);
printf("新密码应用成功!");
sl(2000);
goto rep99;
}
case 0: {
goto admbegin;
}
default: {
Print_pdding();
printf("输入有误,请重新输入。\n");
sl(2000);
goto admbegin;
}
}
}
case 2: {
cls;
newtea(ccx->name);
sl(2000);
goto admbegin;
}
case 0: {
goto admbegin;
}
default: {
Print_pdding();
printf("输入有误,请重新输入。\n");
sl(2000);
goto rep99;
}
}
goto admbegin;
}
case 3: {
cls;
Print_head();
Print_line();
Print_text("1.添加一门新课程");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("2.删除某课程");
for (int i = 0; i < 3; i++)
Print_line();
Print_text("0.返回上一级");
Print_line();
Print_tail(10);
Print_pdding();
printf("您可以选:");
scanf("%d", &opt1);
switch (opt1) {
case 1: {
cls;
Course* rres = (Course*)malloc(sizeof(Course));
rres->next = couhead;
couhead = rres;
rres->top = 0;
rres->notic = 0;
Print_pdding();
printf("请输入新课程名:\n");
Print_pdding();
scanf("%s", rres->name);
Print_pdding();
printf("请输入新课程编号:\n");
Print_pdding();
scanf("%s", rres->number);
Print_pdding();
printf("请输入新课程种类,必修,限选还是选修?\n");
Print_pdding();
scanf("%s", rres->type);
Print_pdding();
printf("请输入新课程学时:\n");
Print_pdding();
scanf("%d", &rres->hours);
Print_pdding();
printf("请输入新课程学分:\n");
Print_pdding();
scanf("%f", &rres->credit);
rep1145:
Print_pdding();
printf("请输入新课程平时分和考试占比(注意两项加和要等于一百):\n");
Print_pdding();
printf("平时分占比:");
scanf("%d", &rres->Daily);
Print_pdding();
printf("考试成绩占比:");
scanf("%d", &rres->Text);
if (rres->Daily + rres->Text != 100) {
cls;
Print_pdding();
printf("两项加和不等于一百,请重新输入。\n");
sl(2000);
goto rep1145;
}
Print_pdding();
printf("新课程添加成功。");
fprintf(his, "\n%s添加了新课程%s", ccx->name, rres->name);
sl(2000);
goto admbegin;
}
case 2: {
char arr[100];
cls;
Print_pdding();
printf("请输入需要删除的课程名称:");
scanf("%s", arr);
Course* a = couhead;
if (strcmp(arr, a->name) == 0) {
couhead = couhead->next;
}
else {
for (Course* b = couhead; b->next != NULL; b = b->next) {
if (strcmp(b->next->name, arr) == 0) {
a = b->next;
b->next = a->next;
break;
}
}
}
if (a == NULL) {
Print_pdding();
printf("课程不存在!\n");
sl(2000);
goto admbegin;
}
for (int i = 1; i <= a->top; ++i) {
stu* ttt = stusearch2(a->stu[i].id, stuhead);
ttt->choo--;
if (ttt->first->tar == a) {
ttt->first = ttt->first->next;
}
else {
for (choose* tt = ttt->first; tt->next != NULL; tt = tt->next) {
if (tt->next->tar == a) {
tt->next = tt->next->next;
break;
}
}
}
}
for (teacher* ui = teahead; ui != NULL; ui = ui->next) {
if (ui->teach == NULL)continue;
if (ui->teach->tar == a) {
ui->tn--;
ui->teach = ui->teach->next;
}
else {
for (choose* oi = ui->teach; oi->next != NULL; oi = oi->next) {
if (oi->next->tar == a) {
ui->tn--;
oi->next = oi->next->next;
break;
}
}
}
}

free(a);
Print_pdding();
printf("课程删除成功!");
sl(2000);
sturecalc(stuhead);
stuhead = stusort(stuhead, cmps31);
getrank(stuhead);

goto admbegin;
}
case 0: {
goto admbegin;
}
default: {
Print_pdding();
printf("输入有误,请重新输入。\n");
sl(2000);
goto admbegin;
}
}
}
case 4: {
char buf[100], obuf[100];
rep56:
memset(buf, 0, sizeof(buf));
memset(obuf, 0, sizeof(obuf));//密,密码过长咋办???
Print_pdding();
printf("请输入您的新密码:\n");//数字啊字符判定啊啥的,还能凹,但是没啥必要
Print_pdding();
scanf("%s", buf);//密码输出出来变星号啊啥的,还能凹,但是我不会了
if (strlen(buf) < 10) {
Print_pdding();
printf("您的密码长度小于10,安全性不强,请重新设定。\n");
goto rep56;
}
Print_pdding();
printf("请再输一遍保证密码正确:\n");
Print_pdding();
scanf("%s", obuf);
if (strcmp(buf, obuf) != 0) {
Print_pdding();
printf("两次密码不一致,请重新设置密码!\n");
Sleep(2000);
system("cls");
goto rep56;
}
fprintf(his, "\n%s修改了他的密码:\n%s变动为%s", ccx->name, ccx->pas, buf);//历史
strcpy(ccx->pas, buf);
Print_pdding();
printf("新密码应用成功!\n");
sl(3000);
cls;
goto admbegin;
}
case 5: {
cls;
Print_pdding();
printf("请输入系统从现在开始维护的天数:");
scanf("%d", &opt1);
if (opt1 >= 0) {
Print_pdding();
printf("设定成功。期间只有管理员可以登录。\n");
}
else {
Print_pdding();
printf("设定失败。原有的设定将保持不变。\n");
}
UPDATE = time(0) + (long long)opt1 * 86400;
fprintf(his, "\n%s设定了系统维护时间为%d天", ccx->name, opt1);
sl(2000);
goto admbegin;
}
case 7: {
fprintf(his, "\n%s退出了登录", ccx->name);
goto bbegin; break;
}
case 0: {
fprintf(his, "\n%s退出了登录", ccx->name);
goto eend; break;
}
case 6: {//大佬,排版,带带
rep308927428:
cls;//只是随机的数加个前缀当段名了,真的没啥意思
jingprr(jinghead);
printf("\n");
Print_pdding();
printf("请输入需要调整竞赛等级的竞赛编号:");
scanf("%d", &opt1);
jing* jkl = jingsearch(opt1, jinghead);
if (jkl != NULL) {
rep9724506:
cls;
printf("\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
for (int i = 0; i < 100; ++i) {
printf("=");
}
printf("\n");
for (int i = 0; i < 30; i++) {
printf(" ");
}
printf("%s %c %d\n", jkl->name, jkl->flg);
for (int i = 0; i < 30; i++) {
printf(" ");
}
for (int i = 0; i < 100; ++i) {
printf("=");
}
printf("\n");
printf("\n");

Print_pdding();
printf("请输入调整之后的竞赛等级(输入A或B或b(代表B*)或者C):");
char vbnm;
getchar();
scanf("%c", &vbnm);
if (vbnm == 'A' || vbnm == 'B' || vbnm == 'b' || vbnm == 'C') {
printf("修改成功!\n");
fprintf(his, "\n管理员%s将%s的竞赛等级调整为%c,原来的等级为%c", ccx->name, jkl->name, vbnm, jkl->flg);//历史
jkl->flg = vbnm;
sl(2000);
goto admbegin;
}
else {
printf("操作数无效,请重新输入。");
sl(2000);
goto rep9724506;
}
}
else {
printf("操作数无效,请重新输入。");
sl(2000);
goto rep308927428;
}
goto admbegin;
}
default: {
Print_pdding();
printf("输入有误,请重新输入。");
sl(2000);
goto admbegin;
break;
}
}
}
else{
Print_pdding();
printf("输入有误!请重新输入!\n");
scanf("%*s");
sl(2000);
goto admbegin;
}

}
else if (opt2 == 0) {
Print_pdding();
printf("密码错误,登录失败,自动返回上一级。\n");
sl(2000);
goto bbegin;
}
else {
Print_pdding();
printf("查无此人,登录失败,自动返回上一级。\n");
sl(2000);
goto bbegin;
}
break;
}
case 0: {
goto eend;
}
default: {
Print_pdding();
printf("输入有误,请重新输入。");
sl(2000);
goto bbegin;
}
}
}
else{
Print_pdding();
printf("输入有误!请重新输入!");
scanf("%*s");
sl(2000);
goto bbegin;
}


//<----------------------------------update------------------------------>
eend:
Print_pdding();
printf("感谢使用。");
sl(2000);
updjidian();
updstu(stuhead);
updtea(teahead);
updcou(couhead);
updunp(teahead);
updupdate();
updcomp(jinghead);
fclose(his);
return 0;
}