forked from wenkai-Y/student-management-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
System_Interfances.h
1244 lines (1211 loc) · 34.4 KB
/
System_Interfances.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
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
/*********************************/
/*************系统界面************/
/*********************************/
#pragma once
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include "Selection_functions.h"
#include "Passwords_Management.h"
#include "Files_Processing.h"
#include "_StuIno_.h"
#include "Data_Analysis .h"
void AdmInterLogon();
int AdmInter();
void TeaInterLogon();
void TeaInter();
int In_School_Grades(struct Student*, int, int);
int bulu(int[], int);
int TeaAddStus();
void Teaprint();
int Tea_fixed();
int dele();
int dele_stu(int);
void findfind();
void SteInter();
void stu_log(string&, char[20], string&, string&);
int StuLogon(string&);
void ShowStuMage(string);
char Students_Ranking(struct Student*, int);
void StuChaPassInter();
void Display_teacher_account_information();
void Display_student_account_information(int);
void Overall_Performance_Analysis(struct Student*, int);
void Analysis_of_all_subjects(struct Student*, int);
void xianshifenshuduan_1(int[3][4]);
void zidingyi(double[2]);
void lext(int renshu[3], double*);
void Exit();
inline void Cls();
using namespace std;
/*****主页界面*****/
void StarInt()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>欢迎来到学生成绩管理系统<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
puts("\t\t\t\t *********************************************");
puts("\t\t\t\t *\t\t *1.教师端登录 *");
puts("\t\t\t\t *\t\t *2.学生端登录 *");
puts("\t\t\t\t *\t\t *3.管理员登录 *");
puts("\t\t\t\t *\t\t *4.退出该系统 *");
puts("\t\t\t\t *********************************************");
cout << endl << "\t\t\t\t >>>请选择您需要的服务:";
switch (StarChoice())
{
case 4:
Exit();
break;
case 3:
{
AdmInterLogon();
a3:
switch (AdmInter())
{
case 1:
{
Display_teacher_account_information();
//cout << "\t\t\t\t\t ***将退出管理员系统" << endl;
cout << "\t\t\t\t\t ";
system("pause");
//StarInt();
goto a3;
}
break;
case 2:
{
int people = showpeoples();
if (people)
{
Display_student_account_information(people);
//cout << "\t\t\t\t\t ***将退出管理员系统" << endl;
}
else
{
Cls();
puts("\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t >>>暂无学生信息,请您录入学生信息或告知学生进行注册<<<");
puts("\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}
cout << "\t\t\t\t\t ";
system("pause");
goto a3;
//StarInt();
}
break;
case 3:
StarInt();
break;
}
}
break;
case 2:
SteInter();
break;
case 1:
TeaInterLogon();
break;
}
}
/******管理员登录界面*****/
void AdmInterLogon()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>>欢迎来到管理员登录界面<<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
puts("\t\t\t\t\t ***用户名: Administrator\n");
cout << "\t\t\t\t\t ***请输入密码:";
string realPass;
char pass[20];
LLogon(pass, 20);
Get_Ador_pass(realPass);
int temp = 0;
if (strcmp(realPass.c_str(), pass))
{
do
{
cout << "\n\t\t\t\t\t >>>您输入的密码错误,请重新输入!!!" << endl;
cout << "\n\t\t\t\t\t ***请输入密码:";
LLogon(pass, 20);
if (!strcmp(realPass.c_str(), pass))
break;
++temp;
if (temp == 2)
{
cout << "\n\t\t\t\t\t***您输入的密码错误次数过多,将强制退出系统!!!" << endl;
cout << "\t\t\t\t\t ";
system("pause");
Exit();
exit(0);
}
} while (true);
}
cout << "\n\t\t\t\t\t &&&密码正确!!!" << endl;
cout << "\t\t\t\t\t ";
system("pause");
}
/*****管理员界面*****/
int AdmInter()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>>>>欢迎来到管理员界面<<<<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
puts("\t\t\t\t *********************************************");
puts("\t\t\t\t *\t\t*1.查看教师账号信息 *");
puts("\t\t\t\t *\t\t*2.查看学生账号信息 *");
puts("\t\t\t\t *\t\t*3.返回上一级 *");
puts("\t\t\t\t *********************************************");
cout << endl << "\t\t\t\t >>>请选择您需要的服务:";
int next;
string next_;
stringstream ints;
cin >> next_;
if (next_ != "1" && next_ != "2" && next_ != "3")
{
do
{
cout << "\t\t\t\t ***您输入的格式有误,请您重新输入!!!" << endl;
cout << endl << "\t\t\t\t >>>请选择您需要的服务:";
cin >> next_;
if (next_ == "1" || next_ == "2" || next_ == "3")
break;
} while (true);
}
ints << next_;
ints >> next;
return next;
}
/*****显示教师账号信息*****/
void Display_teacher_account_information()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>欢迎进入显示教师账号信息界面<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
string password;
Tea_Pass(password);
puts("\t\t\t\t ******************************************");
puts("\t\t\t\t *\t\t*教师账号: 2019-2023 *");
cout << "\t\t\t\t *\t\t*教师密码: ";
cout << setiosflags(ios_base::left) << setw(17) << password << "*" << endl;
puts("\t\t\t\t ******************************************");
}
/*****显示学生账号信息*****/
void Display_student_account_information(int people)
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>欢迎进入显示学生账号信息界面<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
struct Student* stu = new struct Student[people];
GEt_Stu_s(stu, people);
puts("\t\t\t\t ******************************************");
for (int i = 0; i < people; ++i)
{
cout << "\t\t\t\t *\t\t*学生学号: ";
cout << setiosflags(ios_base::left) << setw(17) << stu[i].number << "*" << endl;
cout << "\t\t\t\t *\t\t*学生姓名: ";
cout << setiosflags(ios_base::left) << setw(17) << stu[i].name << "*" << endl;
cout << "\t\t\t\t *\t\t*学生密码: ";
cout << setiosflags(ios_base::left) << setw(17) << stu[i].password << "*" << endl;
puts("\t\t\t\t ******************************************");
}
delete[]stu;
stu = NULL;
}
/*****教师登录界面*****/
void TeaInterLogon()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>>>>>欢迎进入教师系统<<<<<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
puts("\t\t\t\t\t ***用户名: 2019-2023\n");
cout << "\t\t\t\t\t ***请输入密码:";
if (TeaLogon())
TeaInter();
else
{
cout << "\n\t\t\t\t\t ";
system("pause");
Exit();
}
}
/******教师界面*****/
void TeaInter()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>>>>>欢迎进入教师系统<<<<<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
puts("\t\t\t\t *********************************************");
puts("\t\t\t\t *\t\t *1.录入学生信息 *"); //2019-12-11
puts("\t\t\t\t *\t\t *2.录入学生成绩 *");
puts("\t\t\t\t *\t\t *3.查找学生信息 *"); //2019-12-16
puts("\t\t\t\t *\t\t *4.打印学生信息 *"); //2019-12-14
puts("\t\t\t\t *\t\t *5.修改学生信息 *"); //2019-12-14
puts("\t\t\t\t *\t\t *6.分析学生信息 *");
puts("\t\t\t\t *\t\t *7.修改教师密码 *"); //2019-12-11
puts("\t\t\t\t *\t\t *8.退出并返回上一级 *"); //已完成
puts("\t\t\t\t *********************************************");
cout << endl << "\t\t\t\t >>>请选择您需要的服务:";
switch (TeaInerChoice())
{
case 1:
{
TeachersKeepStudentInformation(TeaAddStus());
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
break;
case 2:
{
a9:
int peoples = showpeoples();
struct Student* stu = new struct Student[peoples];
int people = In_School_Grades(stu, peoples, 0);
//cout << people << endl;
if (people)
{
cout << "\t\t\t\t\t ***您共有" << people << "个学生成绩空缺, 请及时录入!!!\n" << endl;
int* ptr_peo = new int[people];
int temp = 0;
for (int f = 0; f < peoples; ++f)
{
if (stu[f].ave == -1)
ptr_peo[temp++] = f;
if (temp == people)
break;
}
for (int i = 0; i < people; ++i)
{
if(i == 0)
cout << "\t\t\t *************************需录入的学生信息**********************" << endl;
showone(stu, ptr_peo[i], 1);
}
int peo_peo = bulu(ptr_peo, people);
if (peo_peo == 0)
{
delete[]ptr_peo;
delete[]stu;
ptr_peo = NULL;
stu = NULL;
TeaInter();
}
else
{
xiugaibulu(stu, peoples, peo_peo - 1);
delete[]ptr_peo;
delete[]stu;
ptr_peo = NULL;
stu = NULL;
goto a9;
}
}
else
{
delete[]stu;
stu = NULL;
puts("\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t >>>>>>>暂无缺少成绩的学生,或请告知学生进行注册<<<<<<<");
puts("\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
}
break;
case 3:
{
a2:
findfind();
int people_3 = showpeoples();
if (people_3)
{
switch (find_stus())
{
case 1:
{
string names = name();
int next = find(names, 0, names);
if (next == 0)
{
cout << "\t\t\t\t\t ";
system("pause");
goto a2;
}
else
{
goto a2;
}
}
break;
case 2:
{
string numbers = number();
int next = find(numbers, 1, numbers);
if (next == 0)
{
cout << "\t\t\t\t\t ";
system("pause");
goto a2;
}
else
{
goto a2;
}
}
break;
case 3:
TeaInter();
break;
}
}
else
{
puts("\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t >>>暂无学生信息,请您录入学生信息或告知学生进行注册<<<");
puts("\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
}
break;
case 4:
{
Teaprint();
Print();
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
break;
case 5:
{
int people = showpeoples();
if (people)
{
int temp = Tea_fixed();
if (temp == 1)
{
fiexd();
cout << "\t\t\t\t\t ";
system("pause");
Cls();
Print();
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
else
if (temp == 2)
{
int retu = dele();
if (retu == 1)
{
cout << "\t\t\t\t\t ***为确保学生信息安全,请输入您的教师密码(仅一次机会):";
string aswer;
char mima[20];
LLogon(mima, 20);
Tea_Pass(aswer);
if (!strcmp(mima, aswer.c_str()))
{
delel();
cout << "\n\t\t\t\t\t ***信息已经全部删除!!!\n";
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
else
{
cout << "\n\t\t\t\t\t !!!您输入的密码错误,无权限删除全部学生信息\n";
cout << "\t\t\t\t ";
system("pause");
TeaInter();
}
}
else
{
//先显示学生信息!!!
Print();
int dele_peo = dele_stu(people);
cout << "\n\t\t\t\t\t ***为确保学生信息安全,请输入您的教师密码(仅一次机会):";
string aswer;
char mima[20];
LLogon(mima, 20);
Tea_Pass(aswer);
if (!strcmp(mima, aswer.c_str()))
{
del_d_stu(dele_peo, people);
//int people = showpeoples();
Cls();
Print();
cout << "\t\t\t\t\t >>>已经修改完信息并保存!!!" << endl;
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
else
{
cout << "\n\t\t\t\t\t !!!您输入的密码错误,无权限删除该学生信息\n";
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
}
}
else
TeaInter();
}
else
{
Cls();
puts("\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t >>>暂无学生信息,请您录入学生信息或告知学生进行注册<<<");
puts("\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
}
break;
case 6:
{
a11:
int peoples = showpeoples();
struct Student* stu = new struct Student[peoples];
int people = In_School_Grades(stu, peoples, 1); //信息未补漏的学生数量
if (!people && peoples != 0)
{
switch (AnalYourChoiOfGrades())
{
case 1:
{
char next = Students_Ranking(stu, peoples);
if (next == 'Y' || next == 'y')
save(stu, peoples);
delete[]stu;
stu = NULL;
cout << "\t\t\t\t\t ";
system("pause");
goto a11;
}
break;
case 2:
{
//总体成绩的分析
Overall_Performance_Analysis(stu, peoples);
delete[]stu;
stu = NULL;
cout << "\t\t\t\t\t ";
system("pause");
goto a11;
}
break;
case 3:
{
Analysis_of_all_subjects(stu, peoples);
delete[]stu;
stu = NULL;
cout << "\t\t\t\t\t ";
system("pause");
goto a11;
}
break;
case 4:
{
a12:
switch (stuFEN())
{
case 1:
{
int fenshu[3][4] = { 0 };
fenshuduan_1(stu, peoples, fenshu);
xianshifenshuduan_1(fenshu);
cout << "\t\t\t\t\t ";
system("pause");
goto a12;
}
break;
case 2:
{
double fenshuxian[2] = { 0 };
int renshu[3] = { 0 };
zidingyi(fenshuxian);
zidingyifenshu(stu, peoples, fenshuxian, renshu);
lext(renshu, fenshuxian);
cout << "\t\t\t\t\t ";
system("pause");
goto a12;
}
break;
case 3:
{
delete[]stu;
stu = NULL;
goto a11;
}
break;
}
}
break;
case 5:
{
delete[]stu;
stu = NULL;
TeaInter();
}
break;
}
}
else
{
if (peoples == 0)
{
Cls();
puts("\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t >>>暂无学生信息,请您录入学生信息或告知学生进行注册<<<");
puts("\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
delete[]stu;
stu = NULL;
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
else
{
Cls();
puts("\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t >>有缺少成绩的学生,请先进行录入成绩,再进行成绩分析<<");
puts("\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
delete[]stu;
stu = NULL;
cout << "\t\t\t\t\t ";
system("pause");
TeaInter();
}
}
}
break;
case 7:
{
Cls();
TeaChangePass();
Cls();
TeaInterLogon();
}
break;
case 8:
{
Cls();
StarInt();
}
break;
}
}
/******教师添加学生信息界面*****/
int TeaAddStus()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>欢迎进入教师添加学生信息界面<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
int next; //定义要输入的人数
stringstream ints;
string input;
cout << "\t\t\t\t\t *请输入您要添加学生的人数:";
cin >> input;
ints << input;
ints >> next;
if (next <= 0)
{
do
{
stringstream temp;
cout << "\t\t\t\t\t *您输入的人数不符合实际,请重新输入!\n" << endl;
cout << "\t\t\t\t\t *请输入您要添加学生的人数:";
cin >> input;
temp << input;
temp >> next;
//cout << next << endl;
if (next > 0)
break;
} while (true);
}
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>欢迎进入教师添加学生信息界面<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
return next;
}
/*****教师录入学生成绩界面*****/
int In_School_Grades(struct Student* ptr, int people, int cha)
{
int next = 0;
if (cha == 0)
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>欢迎进入教师录入学生成绩界面<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}
Get_Mage(ptr);
for (int i = 0; i < people; ++i)
{
if (ptr[i].ave == -1)
{
++next;
}
}
return next;//未录入的人数
}
/*****补录成绩*****/
int bulu(int shuzu[], int peo)
{
int first, flage = 0;
cout << "\t\t\t\t\t 请输入您要补录的学生的序号(0为返回上一级):";
cin >> first;
if (first == 0)
return first;
for (int i = 0; i < peo; ++i)
{
if (shuzu[i] == first - 1)
{
++flage;
break;
}
}
if(flage == 0 || !cin)
{
do
{
cout << "\t\t\t\t\t ***您输入的格式有误,请重新输入!!!" << endl;
cout << "\n\t\t\t\t\t 请输入您要补录的学生的序号(0为返回上一级):";
cin.clear();
cin.sync();
getchar();
cin >> first;
if (first == 0 && cin)
break;
for (int i = 0; i < peo; ++i)
{
if (shuzu[i] == first - 1)
{
++flage;
break;
}
}
if (flage != 0)
break;
} while (true);
}
return first;
}
/*****教师打印学生信息界面*****/
void Teaprint()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>欢迎进入教师打印学生信息界面<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}
/*****教师修改学生信息界面*****/
int Tea_fixed()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>欢迎进入教师修改学生信息界面<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
cout << "\t\t\t\t\t >>>1.修改信息\n";
cout << "\t\t\t\t\t >>>2.删除信息\n";
cout << "\t\t\t\t\t >>>3.返回上一级\n";
cout << "\t\t\t\t\t *请输入您要进行的操作:";
int i;
string next;
cin >> next;
stringstream ints;
if (next != "1" && next != "2" && next != "3")
{
do
{
cout << "\t\t\t\t\t >>>您输入的数据有误,请重新输入!!!" << endl;
cout << "\n\t\t\t\t\t *请输入您要进行的操作:";
cin >> next;
if (next == "1" || next == "2" || next == "3")
break;
} while (true);
}
ints << next;
ints >> i;
return i;
}
/******教师删除学生信息界面*****/
int dele()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>欢迎进入教师删除学生信息界面<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
cout << "\t\t\t\t\t >>>1.删除全部学生信息" << endl;
cout << "\t\t\t\t\t >>>2.删除单个学生信息" << endl;
cout << "\t\t\t\t\t *请输入您的选择:";
int choive;
cin >> choive;
if (choive != 1 && choive != 2 || !cin)
{
do
{
cout << "\t\t\t\t\t >>>您输入的数据有误,请重新输入!!!" << endl;
cout << "\n\t\t\t\t\t *请输入您要进行的操作:";
cin.clear();
cin.sync();
getchar();
cin >> choive;
if (choive == 1 || choive == 2 && cin)
break;
} while (true);
}
return choive;
}
/******教师删除单个学生信息界面*****/
int dele_stu(int people)
{
cout << "\t\t\t\t\t >>>请输入您要删除学生的序号:";
int index;
cin >> index;
if (index < 1 || index > people || !cin)
{
do
{
cout << "\t\t\t\t\t ***您输入的数据有误,请重新输入!!!" << endl;
cout << "\n\t\t\t\t\t >>>请输入您要删除学生的序号:";
cin.clear();
cin.sync();
getchar();
cin >> index;
if (index >= 1 && index <= people && cin)
break;
} while (true);
}
return index;
}
/*****学生成绩排名界面*****/
char Students_Ranking(struct Student* ptr, int people)
{
char next;
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>欢迎进入学生成绩排名界面<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
stu_ranking(ptr, people);
cout << "\t\t\t\t $$$请问是否保存到副本(无法恢复之前排序)!!!?(Y/N):";
cin >> next;
if (next != 'Y' && next != 'y' && next != 'N' && next != 'n')
{
do
{
cout << "\t\t\t\t ***您输入的格式有误,请重新输入!!!" << endl;
cout << "\n\t\t\t\t $$$请问是否保存到副本(无法恢复之前排序)!!!?(Y/N):";
cin >> next;
if (next == 'Y' || next == 'y' || next == 'N' || next == 'n')
break;
} while (true);
}
return next;
}
/*****教师查找学生界面*****/
void findfind()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>欢迎进入查找学生信息系统<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}
/*****学生界面*****/
void SteInter()
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>>>>>欢迎进入学生系统<<<<<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
puts("\t\t\t\t *********************************************");
puts("\t\t\t\t *\t\t *1.学生注册 *");
puts("\t\t\t\t *\t\t *2.学生登录 *");
puts("\t\t\t\t *\t\t *3.学生账号密码修改 *");
puts("\t\t\t\t *\t\t *4.返回上一级 *");
puts("\t\t\t\t *********************************************");
cout << endl << "\t\t\t\t >>>请选择您需要的服务:";
switch (StuInerChoice())
{
case 1:
{
string username, passwords, gender, number;
char password[20];
stu_log(username, password, number, gender);
passwords = password;
Stu_Reg(username, password, number, gender);
cout << "\n\t\t\t\t\t ###您的信息已经注册完成!!!" << endl;
cout << "\t\t\t\t\t ";
system("pause");
SteInter();
}
break;
case 2:
{
string number;
if (StuLogon(number) == 0)
{
cout << "\n\n\t\t\t\t\t &&&您的账户信息不正确,无法登录!!!" << endl;
cout << "\t\t\t\t\t ";
system("pause");
SteInter();
}
else
{
cout << "\n\n\t\t\t\t\t &&&登录成功!!!" << endl;
cout << "\t\t\t\t\t ";
system("pause");
ShowStuMage(number);
SteInter();
}
}
break;
case 3:
{
StuChaPassInter();
}
break;
case 4:
{
Cls();
StarInt();
}
break;
}
}
/*****学生注册界面*****/
void stu_log(string& username, char password[20], string& number, string& gender)
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>欢迎进入学生注册信息界面<<<<");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
cout << "\t\t\t\t\t ***请输入您学号:";
cin >> number;
if (The_user_to_repeat(number))
{
do
{
cout << "\t\t\t\t\t &&&您输入的学号已存在,请重新输入!!!" << endl;
cout << "\n\t\t\t\t\t ***请输入您学号:";
cin >> number;
if (!The_user_to_repeat(number))
break;
} while (true);
}
cout << "\t\t\t\t\t ***请输入您的用户名(自己的名字):";
cin >> username;
cout << "\t\t\t\t\t ***请输入您的性别(男&女):";
cin >> gender;
if ((gender != "男") && (gender != "女"))
{
do
{
cout << "\t\t\t\t\t ***您输入的格式有误,请重新输入!!!" << endl;
cout << "\n\t\t\t\t\t ***请输入您的性别(男&女):";
cin >> gender;
//cout << stu[i - 1].gender << endl;
if (gender == "男" || gender == "女")
break;
} while (true);
}
cout << "\t\t\t\t\t ***请输入您的密码:";
LLogon(password, 20);
char again[20];
cout << "\n\t\t\t\t\t ***请您确认您的密码:";
LLogon(again, 20);
if (strcmp(again, password))
{
int temp = 0;
do
{
cout << "\n\t\t\t\t\t >>>您输入的两次密码不正确,请您重新输入!!!" << endl;
cout << "\n\t\t\t\t\t ***请您确认您的密码:";
LLogon(again, 20);
if (!strcmp(again, password))
break;
++temp;
if (temp == 2)
{
cout << "\n\n\t\t\t\t\t $$$注册密码时密码不一致次数过多,将强制退出系统!!!" << endl;
cout << "\t\t\t\t\t ";
system("pause");
Exit();
exit(0);
}
} while (true);
}
}
/*****学生登录界面*****/
int StuLogon(string& numbers)
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
puts("\t\t\t\t\t >>>>>>欢迎进入学生登录界面<<<<<< ");
puts("\t\t\t\t\t <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
string number, username, password;
char passwords[20];
cout << "\t\t\t\t\t ***请输入您的学号:";
cin >> number;
cout << "\t\t\t\t\t ***请输入您的用户名:";
cin >> username;
cout << "\t\t\t\t\t ***请输入您的密码(初始密码为您的学号):";
LLogon(passwords, 20);
password = passwords;
numbers = number;
return Stu_Pass(number, username, password);//会返回return 值
}
/*****学生登陆成功后显示界面*****/
void ShowStuMage(string number)
{
Cls();
puts("\t\t\t\t\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");