高校人员信息管理系统设计,供大家参考,具体内容如下
一、问题描述及功能要求
1、问题描述
某高校有四类员工:教师、实验员、行政人员,教师兼行政人员;共有的信息包括:编号、姓名、性别、年龄等。其中,教师还包含的信息有:所在系部、专业、职称;实验员还包含的信息由:所在实验室、职务;行政人员还包含的信息有:政治面貌、职称等。
2、功能要求
(1)添加功能:程序能够任意添加上述四类人员的记录,可提供选择界面供用户选择所要添加的人员类别,要求员工的编号要唯一,如果添加了重复编号的记录时,则提示数据添加重复并取消添加。
(2)查询功能:可根据编号、姓名等信息对已添加的记录进行查询,如果未找到,给出相应的提示信息,如果找到,则显示相应的记录信息。
(3)显示功能:可显示当前系统中所有记录,每条记录占据一行。
(4)编辑功能:可根据查询结果对相应的记录进行修改,修改时注意编号的唯一性。
(5)删除功能:主要实现对已添加的人员记录进行删除。如果当前系统中没有相应的人员记录,则提示“记录为空!”并返回操作;否则,输入要删除的人员的编号或姓名,根据所输入的信息删除该人员记录,如果没有找到该人员信息,则提示相应的记录不存。
(6)统计功能:能根据多种参数进行人员的统计。能统计四类人员数量以及总数,统计男、女员工的数量。
(7)保存功能:可将当前系统中各类人员记录存入文件中,存入方式任意。
(8)读取功能:可将保存在文件中的人员信息读入到当前系统中,供用户进行使用。
二、代码实现 带有注释
废话不说,直接代码,欢迎指正。
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
|
#include"iostream"
#include <fstream>
#include"stdlib.h"
#define MAX 100
using namespace std;
class person //定义一个类实现共有的基础信息
{
public :
int num;
char name[20];
char sex[4];
int age;
};
//Teacher class
class Teacher: virtual public person
{
public :
char dept[20];
char special[20];
char title[20];
void Input() //录入信息
{
cout<< "Input num:" ;cin>>num;
cout<< "Input name:" ;cin>>name;
cout<< "Input sex:" ;cin>>sex;
cout<< "Input age:" ;cin>>age;
cout<< "Input dept:" ;cin>>dept;
cout<< "Input special:" ;cin>>special;
cout<< "Input title:" ;cin>>title;
}
void Output() //输出信息
{
cout<< "编号: " <<num<< " " << "姓名: " <<name<< " " << "性别: " <<sex<< " " << "年龄: " <<age<<
" " << "所在系: " <<dept<< " " << "专业: " <<special<< " " << "职称: " <<title<<endl;
}
};
Teacher Tea[MAX]; //定义一个教师的对象数组
static int Teatop; //定义一个静态常量
class TeaManager //教师的管理类
{
public :
int Add();
int Search();
void Show();
void Edit();
int Delete();
void Save();
void Read();
};
int TeaManager::Add() //添加功能
{
system ( "cls" ); //清屏
Teacher t;
int i,nu;
if (Teatop==MAX)
{cout<< "人数已满" <<endl;
return 0;
}
cout<< "请输入编号:" ;cin>>nu;
for (i=0;i<Teatop;i++)
{
if (nu==Tea[i].num)
{cout<< "已有该编号" <<endl;
return 0;
}
}
t.Input();Tea[Teatop]=t;Teatop++;
cout<< "添加成功!" <<endl;
return 1;
}
int TeaManager::Search() //查询功能
{
system ( "cls" );
int j,n;
cout<< "请输入编号:" ;cin>>n;
for (j=0;j<Teatop;j++)
{
if (n==Tea[j].num) break ;
}
if (j==Teatop)
cout<< "没有此人!" <<endl;
else
Tea[j].Output();
return 1;
}
void TeaManager::Show() //显示功能
{
system ( "cls" );
int i;
if (Teatop==0)
{cout<< "记录为空!" <<endl; return ;}
for (i=0;i<Teatop;i++)
Tea[i].Output();
}
void TeaManager::Edit() //编辑功能
{
system ( "cls" ); //清屏
Teacher t1;
int j,n;
cout<< "请输入要编辑的人的编号:" ;cin>>n;
for (j=0;j<Teatop;j++)
{
if (n==Tea[j].num) break ;
}
if (j==Teatop)
{cout<< "没有此人!" <<endl; return ;};
cout<< "输入修改后的信息,编号不能改:" <<endl;
t1.Input();
Tea[j]=t1;
cout<< "编辑成功!" <<endl;
}
int TeaManager::Delete() //删除功能
{
system ( "cls" ); //清屏
int j,n;
cout<< "请输入要删除的人的编号:" ;cin>>n;
for (j=0;j<Teatop;j++)
{
if (n==Tea[j].num) break ;
}
if (j==Teatop)
{cout<< "没有此人!" <<endl; return 0;};
for (j;j<Teatop;j++)
{
Tea[j]=Tea[j+1];
}
Teatop--;
cout<< "删除成功!" <<endl;
return 1;
}
void TeaManager::Save() //保存功能
{
system ( "cls" ); //清屏
int i;
ofstream outfile,outfile1;
outfile1.open( "Teatop.dat" ,ios::out);
outfile1<<Teatop;
outfile.open( "Tea_data.dat" ,ios::binary);
if (!outfile)
{cerr<< "open error!" <<endl; return ; }
for (i=0;i<Teatop;i++)
outfile.write(( char *)&Tea[i], sizeof (Tea[i]));
outfile.close();
cout<< "保存成功!" <<endl;
}
void TeaManager::Read() //读取功能
{
system ( "cls" );
int i;
ifstream infile,infile1;
infile1.open( "Teatop.dat" ,ios::in);
infile1>>Teatop;
infile.open( "Tea_data.dat" ,ios::binary);
if (!infile)
{cerr<< "open error!" <<endl; return ; }
for (i=0;i<Teatop;i++)
infile.read(( char *)&Tea[i], sizeof (Tea[i]));
infile.close();
cout<< "读取成功!" <<endl;
}
void Tea_mune(TeaManager TM) //用一个管理教师的类来实现结果的显示
{
system ( "cls" );
int b;
char c;
do {
cout<<endl;cout<<endl;
cout<< "教师管理" <<endl;
cout<< "==========================================================================================" <<endl;
cout<< "| 1.添加 " ;
cout<< "2.查询 " ;
cout<< "3.显示 " ;
cout<< "4.编辑 " ;
cout<< "5.删除 " ;
cout<< "6.统计 " ;
cout<< "7.保存 " ;
cout<< "8.读取 " ;
cout<< "0.退出 |" <<endl;
cout<< "==========================================================================================" <<endl;
cout<< "请选择:" ;cin>>b;
switch (b)
{
case 1:TM.Add(); break ;
case 2:TM.Search(); break ;
case 3:TM.Show(); break ;
case 4:TM.Edit(); break ;
case 5:TM.Delete(); break ;
case 6:cout<< "共有教师人数:" <<Teatop<<endl; break ; //统计功能
case 7:TM.Save(); break ;
case 8:TM.Read(); break ;
default :cout<< "\n error" <<endl; break ;
case 0: break ;
}
} while (b!=0);
}
class Tester: virtual public person //实验员
{
public :
char testroom[10];
char post[10];
void Input()
{
cout<< "Input num:" ;cin>>num;
cout<< "Input name:" ;cin>>name;
cout<< "Input sex:" ;cin>>sex;
cout<< "Input age:" ;cin>>age;
cout<< "Input testroom:" ;cin>>testroom;
cout<< "Input post:" ;cin>>post;
}
void Output()
{
cout<< "编号: " <<num<< " " << "姓名: " <<name<< " " << "性别: " <<sex<< " " << "年龄: " <<age<<
" " << "所在实验室: " <<testroom<< " " << "职务: " <<post<<endl;
}
};
Tester Test[MAX];
static int Testop;
class TestManager //管理实验员的类
{
public :
int Add();
int Search();
void Show();
void Edit();
int Delete();
void Save();
void Read();
};
int TestManager::Add()
{
system ( "cls" );
Tester t;
int i,nu;
if (Testop==MAX)
{cout<< "人数已满" <<endl;
return 0;
}
cout<< "请输入编号:" ;cin>>nu;
for (i=0;i<Testop;i++)
{
if (nu==Test[i].num)
{cout<< "已有该编号" <<endl;
return 0;
}
}
t.Input();
Test[Testop]=t;
Testop++;
cout<< "添加成功!" <<endl;
return 1;
}
int TestManager::Search()
{
system ( "cls" );
int j,n;
cout<< "请输入编号:" ;cin>>n;
for (j=0;j<Testop;j++)
{
if (n==Test[j].num) break ;
}
if (j==Testop)
cout<< "没有此人!" <<endl;
else
Test[j].Output();
return 1;
}
void TestManager::Show()
{
system ( "cls" );
int i;
if (Testop==0)
{cout<< "记录为空!" <<endl; return ;}
for (i=0;i<Testop;i++)
Test[i].Output();
}
void TestManager::Edit()
{ system ( "cls" );
Tester t1;
int j,n;
cout<< "请输入要编辑的人的编号:" ;cin>>n;
for (j=0;j<Testop;j++)
{
if (n==Test[j].num) break ;
}
if (j==Testop)
{cout<< "没有此人!" <<endl; return ;};
cout<< "输入修改后的信息,编号不能改:" <<endl;
t1.Input();
Test[j]=t1;
cout<< "编辑成功!" <<endl;
}
int TestManager::Delete()
{
system ( "cls" );
int j,n;
cout<< "请输入要删除的人的编号:" ;cin>>n;
for (j=0;j<Testop;j++)
{
if (n==Test[j].num) break ;
}
if (j==Testop)
{cout<< "没有此人!" <<endl; return 0;};
for (j;j<Testop;j++)
{
Test[j]=Test[j+1];
}
Testop--;
cout<< "删除成功!" <<endl;
return 1;
}
void TestManager::Save()
{
system ( "cls" );
int i;
ofstream outfile,outfile1;
outfile1.open( "Testop.dat" ,ios::out);
outfile1<<Testop;
outfile.open( "Test_data.dat" ,ios::binary);
if (!outfile)
{cerr<< "open error!" <<endl; return ; }
for (i=0;i<Testop;i++)
outfile.write(( char *)&Test[i], sizeof (Test[i]));
outfile.close();
cout<< "保存成功!" <<endl;
}
void TestManager::Read()
{
system ( "cls" );
int i;
ifstream infile,infile1;
infile1.open( "Testop.dat" ,ios::in);
infile1>>Testop;
infile.open( "Test_data.dat" ,ios::binary);
if (!infile)
{cerr<< "open error!" <<endl; return ; }
for (i=0;i<Testop;i++)
infile.read(( char *)&Test[i], sizeof (Test[i]));
infile.close();
cout<< "读取成功!" <<endl;
}
void Test_mune(TestManager TM)
{
system ( "cls" );
int b;
char c;
do {
cout<<endl;cout<<endl;
cout<< "实验人员管理" <<endl;
cout<< "==========================================================================================" <<endl;
cout<< "| 1.添加 " ;
cout<< "2.查询 " ;
cout<< "3.显示 " ;
cout<< "4.编辑 " ;
cout<< "5.删除 " ;
cout<< "6.统计 " ;
cout<< "7.保存 " ;
cout<< "8.读取 " ;
cout<< "0.退出 |" <<endl;
cout<< "==========================================================================================" <<endl;
cout<< "请选择:" ;cin>>b;
switch (b)
{
case 1:TM.Add(); break ;
case 2:TM.Search(); break ;
case 3:TM.Show(); break ;
case 4:TM.Edit(); break ;
case 5:TM.Delete(); break ;
case 6:cout<< "共有实验员人数:" <<Testop<<endl; break ;
case 7:TM.Save(); break ;
case 8:TM.Read(); break ;
default :cout<< "\n error" <<endl; break ;
case 0: break ;
}
} while (b!=0);
}
class Policer: virtual public person //行政人员
{
public :
char polices[10];
char post1[10];
void Input()
{
cout<< "Input num:" ;cin>>num;
cout<< "Input name:" ;cin>>name;
cout<< "Input sex:" ;cin>>sex;
cout<< "Input age:" ;cin>>age;
cout<< "Input polices:" ;cin>>polices;
cout<< "Input post1:" ;cin>>post1;
}
void Output()
{
cout<< "编号: " <<num<< " " << "姓名: " <<name<< " " << "性别: " <<sex<< " " << "年龄: " <<age<<
" " << "政治面貌: " <<polices<< " " << "职称: " <<post1<<endl;
}
};
Policer Policers[MAX];
static int Policersop;
class PolicerManager //管理行政人员的类
{
public :
int Add();
int Search();
void Show();
void Edit();
int Delete();
void Save();
void Read();
};
int PolicerManager::Add()
{
system ( "cls" );
Policer t;
int i,nu;
if (Policersop==MAX)
{cout<< "人数已满" <<endl;
return 0;
}
cout<< "请输入编号:" ;cin>>nu;
for (i=0;i<Policersop;i++)
{
if (nu==Policers[i].num)
{cout<< "已有该编号" <<endl;
return 0;
}
}
t.Input();
Policers[Policersop]=t;
Policersop++;
cout<< "添加成功!" <<endl;
return 1;
}
int PolicerManager::Search()
{
system ( "cls" );
int j,n;
cout<< "请输入编号:" ;cin>>n;
for (j=0;j<Policersop;j++)
{
if (n==Policers[j].num) break ;
}
if (j==Policersop)
cout<< "没有此人!" <<endl;
else
Policers[j].Output();
return 1;
}
void PolicerManager::Show()
{
system ( "cls" );
int i;
if (Policersop==0)
{cout<< "记录为空!" <<endl; return ;}
for (i=0;i<Policersop;i++)
Policers[i].Output();
}
void PolicerManager::Edit()
{ system ( "cls" );
Policer t1;
int j,n;
cout<< "请输入要编辑的人的编号:" ;cin>>n;
for (j=0;j<Policersop;j++)
{
if (n==Policers[j].num) break ;
}
if (j==Policersop)
{cout<< "没有此人!" <<endl; return ;};
cout<< "输入修改后的信息,编号不能改:" <<endl;
t1.Input();
Policers[j]=t1;
cout<< "编辑成功!" <<endl;
}
int PolicerManager::Delete()
{
system ( "cls" );
int j,n;
cout<< "请输入要删除的人的编号:" ;cin>>n;
for (j=0;j<Policersop;j++)
{
if (n==Policers[j].num) break ;
}
if (j==Policersop)
{cout<< "没有此人!" <<endl; return 0;};
for (j;j<Policersop;j++)
{
Policers[j]=Policers[j+1];
}
Policersop--;
cout<< "删除成功!" <<endl;
return 1;
}
void PolicerManager::Save()
{
system ( "cls" );
int i;
ofstream outfile,outfile1;
outfile1.open( "Policersop.dat" ,ios::out);
outfile1<<Policersop;
outfile.open( "Policers_data.dat" ,ios::binary);
if (!outfile)
{cerr<< "open error!" <<endl; return ; }
for (i=0;i<Policersop;i++)
outfile.write(( char *)&Policers[i], sizeof (Policers[i]));
outfile.close();
cout<< "保存成功!" <<endl;
}
void PolicerManager::Read()
{
system ( "cls" );
int i;
ifstream infile,infile1;
infile1.open( "Policersop.dat" ,ios::in);
infile1>>Policersop;
infile.open( "Policers_data.dat" ,ios::binary);
if (!infile)
{cerr<< "open error!" <<endl; return ; }
for (i=0;i<Policersop;i++)
infile.read(( char *)&Policers[i], sizeof (Policers[i]));
infile.close();
cout<< "读取成功!" <<endl;
}
void Policers_mune(PolicerManager TM)
{
system ( "cls" );
int b;
char c;
do {
cout<<endl;cout<<endl;
cout<< "行政人员管理" <<endl;
cout<< "==========================================================================================" <<endl;
cout<< "| 1.添加 " ;
cout<< "2.查询 " ;
cout<< "3.显示 " ;
cout<< "4.编辑 " ;
cout<< "5.删除 " ;
cout<< "6.统计 " ;
cout<< "7.保存 " ;
cout<< "8.读取 " ;
cout<< "0.退出 |" <<endl;
cout<< "==========================================================================================" <<endl;
cout<< "请选择:" ;cin>>b;
switch (b)
{
case 1:TM.Add(); break ; //TM去调用add类
case 2:TM.Search(); break ;
case 3:TM.Show(); break ;
case 4:TM.Edit(); break ;
case 5:TM.Delete(); break ;
case 6:cout<< "共有行政员人数:" <<Policersop<<endl; break ;
case 7:TM.Save(); break ;
case 8:TM.Read(); break ;
default :cout<< "\n error" <<endl; break ;
case 0: break ;
}
} while (b!=0);
}
class Teapoli: virtual public person //教师兼行政
{
public :
void Input() //录入信息
{
cout<< "Input num:" ;cin>>num;
cout<< "Input name:" ;cin>>name;
cout<< "Input sex:" ;cin>>sex;
cout<< "Input age:" ;cin>>age;
}
void Output() //输出信息
{
cout<< "编号: " <<num<< " " << "姓名: " <<name<< " " << "性别: " <<sex<< " " << "年龄: " <<age<<endl;
}
};
Teapoli Teap[MAX];
static int Teapolitop;
class TeapoliManager //教师兼行政管理类
{
public :
int Add();
int Search();
void Show();
void Edit();
int Delete();
void Save();
void Read();
};
int TeapoliManager::Add() //添加功能
{
system ( "cls" ); //清屏
Teapoli t;
int i,nu;
if (Teapolitop==MAX)
{cout<< "人数已满" <<endl;
return 0;
}
cout<< "请输入编号:" ;cin>>nu;
for (i=0;i<Teapolitop;i++)
{
if (nu==Teap[i].num)
{cout<< "已有该编号" <<endl;
return 0;
}
}
t.Input();Teap[Teapolitop]=t;Teapolitop++;
cout<< "添加成功!" <<endl;
return 1;
}
int TeapoliManager::Search() //查询功能
{
system ( "cls" );
int j,n;
cout<< "请输入编号:" ;cin>>n;
for (j=0;j<Teapolitop;j++)
{
if (n==Teap[j].num) break ;
}
if (j==Teapolitop)
cout<< "没有此人!" <<endl;
else
Teap[j].Output();
return 1;
}
void TeapoliManager::Show() //显示功能
{
system ( "cls" );
int i;
if (Teapolitop==0)
{cout<< "记录为空!" <<endl; return ;}
for (i=0;i<Teapolitop;i++)
Teap[i].Output();
}
void TeapoliManager::Edit() //编辑功能
{
system ( "cls" ); //清屏
Teapoli t1;
int j,n;
cout<< "请输入要编辑的人的编号:" ;cin>>n;
for (j=0;j<Teapolitop;j++)
{
if (n==Teap[j].num) break ;
}
if (j==Teapolitop)
{cout<< "没有此人!" <<endl; return ;};
cout<< "输入修改后的信息,编号不能改:" <<endl;
t1.Input();
Teap[j]=t1;
cout<< "编辑成功!" <<endl;
}
int TeapoliManager::Delete() //删除功能
{
system ( "cls" ); //清屏
int j,n;
cout<< "请输入要删除的人的编号:" ;cin>>n;
for (j=0;j<Teapolitop;j++)
{
if (n==Teap[j].num) break ;
}
if (j==Teapolitop)
{cout<< "没有此人!" <<endl; return 0;};
for (j;j<Teapolitop;j++)
{
Teap[j]=Teap[j+1];
}
Teapolitop--;
cout<< "删除成功!" <<endl;
return 1;
}
void TeapoliManager::Save() //保存功能
{
system ( "cls" ); //清屏
int i;
ofstream outfile,outfile1;
outfile1.open( "Teatop.dat" ,ios::out);
outfile1<<Teapolitop;
outfile.open( "Tea_data.dat" ,ios::binary);
if (!outfile)
{cerr<< "open error!" <<endl; return ; }
for (i=0;i<Teapolitop;i++)
outfile.write(( char *)&Tea[i], sizeof (Tea[i]));
outfile.close();
cout<< "保存成功!" <<endl;
}
void TeapoliManager::Read() //读取功能
{
system ( "cls" );
int i;
ifstream infile,infile1;
infile1.open( "Teatop.dat" ,ios::in);
infile1>>Teapolitop;
infile.open( "Tea_data.dat" ,ios::binary);
if (!infile)
{cerr<< "open error!" <<endl; return ; }
for (i=0;i<Teapolitop;i++)
infile.read(( char *)&Teap[i], sizeof (Teapoli[i]));
infile.close();
cout<< "读取成功!" <<endl;
}
void Teapoli_mune(TeapoliManager TM)
{
system ( "cls" );
int b;
char c;
do {
cout<<endl;cout<<endl;
cout<< "教师兼行政管理" <<endl;
cout<< "==========================================================================================" <<endl;
cout<< "| 1.添加 " ;
cout<< "2.查询 " ;
cout<< "3.显示 " ;
cout<< "4.编辑 " ;
cout<< "5.删除 " ;
cout<< "6.统计 " ;
cout<< "7.保存 " ;
cout<< "8.读取 " ;
cout<< "0.退出 |" <<endl;
cout<< "==========================================================================================" <<endl;
cout<< "请选择:" ;cin>>b;
switch (b)
{
case 1:TM.Add(); break ;
case 2:TM.Search(); break ;
case 3:TM.Show(); break ;
case 4:TM.Edit(); break ;
case 5:TM.Delete(); break ;
case 6:cout<< "共有教师兼行政人数:" <<Teapolitop<<endl; break ; //统计功能
case 7:TM.Save(); break ;
case 8:TM.Read(); break ;
default :cout<< "\n error" <<endl; break ;
case 0: break ;
}
} while (b!=0);
}
int main() //主函数
{
TeaManager Tmer1;
TestManager Tetmer;
PolicerManager Polimer;
TeapoliManager Tp;
int a=1,m=0;
char c;
cout<< " *************************************" ;
cout<<endl<< " $ 高校人员管理系统 $" <<endl;
cout<< " *************************************" ;
cout<<endl<< "请输入密码:" ;cin>>m;
if (m!=666666)
{
cout<< "密码错误!" <<endl;
c= getchar ();
return 0;
}
while (a)
{ system ( "cls" );
cout<<endl;
cout<< " ****欢迎使用高校人员信息管理系统****" <<endl;
cout<< " =================================" <<endl;
cout<< " | 1.教师管理 |" <<endl;
cout<< " | 2.实验员管理 |" <<endl;
cout<< " | 3.行政员管理 |" <<endl;
cout<< " | 4.教师兼行政管理 |" <<endl;
cout<< " | 0.退出 |" <<endl;
cout<< " =================================" <<endl;
cout<< "请选择:" ;cin>>a;
switch (a) //用switch语句来判断输入的数字
{
case 1:Tea_mune(Tmer1); break ;
case 2:Test_mune(Tetmer); break ;
case 3:Policers_mune(Polimer); break ;
case 4:Teapoli_mune(Tp); break ;
case 0: break ;
default :cout<< "\n error" <<endl;
cout<< "按回车键继续" <<endl;
c= getchar ();
break ;
}
}
system ( "cls" );
cout<<endl<< "谢谢使用" <<endl;
c= getchar ();
return 0;
}
|
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/m0_46525584/article/details/106640799