本文实例为大家分享了C++实现学生选课系统的具体代码,供大家参考,具体内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
|
#include <iostream> #include <iomanip> #include <fstream> #include<Windows.h> #include<cstring> using namespace std; struct SubList /*某个学生所学的课程中的某一个 */ { int num; /*课程代号 */ SubList *next; /*指向下一个课程的指针*/ SubList() :num(-1), next(NULL){} /*构造函数*/ }; struct StuList /*课程中所选的学生*/ { int num; /* 学生的学号*/ float score; /*学生所得的该课程分数*/ StuList *next; /*下一个学生*/ StuList() :num(-1), score(0), next(NULL){} }; class Student { private : int Num; /*学号*/ char Name[20]; /*学生的姓名 */ int MaxSubNum; /*学生最多可以学五门课程 */ int FactSubNum; /* 学生实际所学的课程数目 */ SubList *Root; /*课程的指针*/ float SumXueFen; /*总的选课学分*/ float FactXueFen; /*实际获得学分*/ float SumGrade; /*总成绩*/ bool Update; /*是否需要更新信息*/ public : Student *next; /*让所有学生的信息连接起来*/ SubList *GetSubPtr() const { return Root; } /*获取所选的课程表*/ Student() :Update( false ), Root( new SubList()), FactXueFen(0), MaxSubNum(5), FactSubNum(0), SumXueFen(0), SumGrade(0),next(NULL){} void SetName( char N[]){ strcpy (Name, N); } /* 设置学生的姓名 */ void SetNum( int num){ Num = num; } /*设置学号*/ const char * GetName() const { return Name; } /*得到学生的姓名 */ int GetNum() const { return Num; } /*得到学号*/ int GetFactSubNum() const { return FactSubNum; } /*得到实际选课数*/ bool FindSub( int num) const ; /*查找是否已有此课程,如果有返回,如果没有返回 */ void SetInfo( float sumXueFen, float factXueFen, float sumGrade) { SumXueFen = sumXueFen; /*这三条信息因为一起用 所以一起设置了*/ FactXueFen = factXueFen; SumGrade = sumGrade; } void SetUpdate( bool t){ Update = t; } /*是否更新信息的标志*/ float GetAveGrade(){ return SumGrade / FactSubNum; } /*学生课程的平均成绩*/ void AddSub( int num); /*增加课程*/ bool IsFull() const { return MaxSubNum == FactSubNum; } void ShowStuInfo(); /*输出学生信息*/ void DelSub( int num); /*删除课程 Manage类使用*/ ~Student() /*析构函数 不要也行影响不太大 一般程序,还不太会内存用完*/ { SubList *p = Root; while (p) { SubList*t = p->next; delete p; p = t; } } }; //课程类 class Subject { private : int MaxStuNum; /*最多学生数*/ int FactStuNum; /*实际学生数*/ float Credit; /*该课程的学分 */ char Name[20]; /* 该课程的名称 */ int Num; /*课程的代号*/ StuList *Root; /* 学生名单 */ float AveGrade; /*该课程的平均成绩 */ bool Update; /*是否更新信息*/ public : StuList *GetStuPtr() const { return Root; } /*获取选此课程的学生表*/ Subject*next; Subject() :Root( new StuList()), MaxStuNum(30), FactStuNum(0), Update( false ),next(NULL){} float GetCredit() const { return Credit; } //得到课程的学分 void SetCredit( float credit){ Credit = credit; } //设置学分 const char * GetName() const { return Name; } //读出课程的名称 void SetName( char N[]){ strcpy (Name, N); } //设置课程的名称 int GetNum() const { return Num; } //读出课程的代号 void SetNum( int num){ Num = num; } //设置课程的代号 int GetFactStuNum() const { return FactStuNum; } //返回实际学生数 int GetMaxStuNum() const { return MaxStuNum; } //最大学生数 void SetUpdate( bool t){ Update = t; } void SetAveGrade( float num){ AveGrade = num/FactStuNum; } //设置平均分 float GetAveGrade(){ return AveGrade; } //得到学生的平均成绩 float GetStuScore( int num); //查找某个学生的成绩 bool IsFull() const { return MaxStuNum == FactStuNum; } //是否人数已满 void DelStu( int num); //删除学生 void AddStu( int num); //增加学生 ~Subject() { StuList *p = Root; while (p) { StuList*t = p->next; delete p; p = t; } } }; float Subject::GetStuScore( int num) { StuList*p = Root->next; while (p->num != num) p = p->next; return p->score; } void Student::ShowStuInfo() { cout << Num << " " << Name << " " << "选课数:" << FactSubNum << endl; cout << "\t\t 总成绩" << SumGrade << " 平均分" << GetAveGrade() << endl; cout << "\t\t课程总学分" << SumXueFen << " 获得学分" << FactXueFen << endl; system ( "pause" ); } bool Student::FindSub( int num) const //查找是否已有此课程,如果有返回,如果没有返回 { bool t = false ; SubList *p = Root->next; while (!t && p) { if (p->num == num) t = true ; p = p->next; } return t; } void Student::AddSub( int num) //给学生增加一门课 { SubList *s = new SubList(), *p = Root; while (p->next) p = p->next; p->next = s; s->num = num; FactSubNum++; Update = true ; } void Student::DelSub( int num) { SubList*p = Root, *t; while (p->next->num != num) p = p->next; t = p->next; p->next = t->next; FactSubNum--; Update = true ; delete t; } //////////////////////////Subject////////////////////////////////// void Subject::AddStu( int num) // { StuList *s = new StuList(), *p = Root; while (p->next) p = p->next; p->next = s; s->num = num; FactStuNum++; Update = true ; } void Subject::DelStu( int num) { StuList*p = Root, *t; while (p->next->num != num) p = p->next; t = p->next; p->next = t->next; FactStuNum--; Update = true ; delete t; } ////////////////////////////////////////////////////////// class Manage { private : Student*StuRoot; Subject*SubRoot; bool Update; public : Manage() :StuRoot( new Student()), SubRoot( new Subject()),Update( false ){} Manage( const Manage&p){} void AddStu(); void AddSub(); Student*FindStu( int num); Subject*FindSub( int num); int ShowSub() const ; //显示可选课程 int ShowStu() const ; void ShowStuSubInfo(Student*p); void DelStu(Student*p); void DelSub(Subject*p); void Start(); int menu(); int custom(); int server(); Student* password1(); bool password2(); void menu_1_1(Student*p); void menu_2_1(); void menu_2_2(); void menu_2_3(); void menu_2_4(); void menu_2_5(); void menu_2_6(); void menu_2_7(); void menu_2_8(); void menu_2_9(); void IsUpdate() { if (Update == true ) { Student*p = StuRoot->next; Subject*q = SubRoot->next; while (q) { float sum = 0; StuList *t =q->GetStuPtr()->next; while (t) { sum += t->score; t = t->next; } q->SetAveGrade(sum); q->SetUpdate( false ); q = q->next; } while (p) { float sum = 0, xuefen = 0, xuefen1 = 0; SubList *t = p->GetSubPtr()->next; while (t) { Subject*tt = FindSub(t->num); xuefen += tt->GetCredit(); float f = tt->GetStuScore(p->GetNum()); sum += f; if (f>= 60) xuefen1 += tt->GetCredit(); t = t->next; } p->SetInfo(xuefen, xuefen1, sum); p->SetUpdate( false ); p= p->next; } Update = false ; } } }; void Manage::DelStu(Student*p) { SubList *l = p->GetSubPtr()->next; while (l) { FindSub(l->num)->DelStu(p->GetNum()); l = l->next; } Student*t = StuRoot; while (t->next != p) t = t->next; t->next = p->next; delete p; Update = true ; } void Manage::DelSub(Subject*p) { StuList *l = p->GetStuPtr()->next; while (l) { FindStu(l->num)->DelSub(p->GetNum()); l = l->next; } Subject*t = SubRoot; while (t->next != p) t = t->next; t->next = p->next; delete p; Update = true ; } int Manage::ShowSub() const { Subject*p = SubRoot->next; int n = 0; while (p) { cout << p->GetNum() << " " << p->GetName() << " 学分:" << p->GetCredit() << endl; n++; p = p->next; } return n; } int Manage::ShowStu() const { Student*p = StuRoot->next; int n = 0; while (p) { cout << p->GetNum() << " " << p->GetName() << endl; n++; p = p->next; } return n; } Student*Manage::FindStu( int num) { Student*p = StuRoot->next; while (p) { if (p->GetNum() == num) break ; p = p->next; } return p; } Subject*Manage::FindSub( int num) { Subject*p = SubRoot->next; while (p) { if (p->GetNum() == num) break ; p = p->next; } return p; } //总菜单 int Manage::menu() { int k = 0, n; while (1) { system ( "cls" ); cout << endl << endl; cout << "*******************************************\n" << "* *\n" << "* 学生选修课系统 *\n" << "* *\n" << "* 操作方式: *\n" << "* 1.选修课系统学生端 *\n" << "* *\n" << "* 2.选修课系统管理端 *\n" << "* 0. 退出 *\n" << "*******************************************\n" << endl; cout << "\n\t\t请选择登入方式: " ; cin >> n; if (n > -1 && n < 3) return n; else { cerr << "\n\n\t\t\t\t输入有误!\n" << endl; k++; } if (k == 3) { cerr << "\n\n\n\t\t~~提示~~:错误输入次数超过三次,你将被强制退出!!\n\n" << endl; return 0; } system ( "pause" ); } } //选修课系统端操作 int Manage::custom() { int n, k = 0; while (1) { system ( "cls" );; cout << "\n\n\n" << "※※※※※※※※※※※※※※※※※※※※※※※※※※\n" << "※ 选修课系统学生端 ※\n" << "※ ※\n" << "※ 操作方式:. ※\n" << "※ 1、 学生选课 ※\n" << "※ 2、 学生情况 ※\n" << "※ 3、 选课情况 ※\n" << "※ 4、 退出系统 ※\n" << "※ ※\n" << "※※※※※※※※※※※※※※※※※※※※※※※※※※\n" << endl; cout << "\t\t\t请选择操作方式: " ; cin >> n; if (n > 0 && n < 5) return n; else { cerr << "\n\t\t\t\t输入有误!请重新输入\n" << endl; k++; } if (k == 3) { system ( "cls" ); cerr << "错误输入超过三次!你将被强制退出!!\n" << endl; return 4; } system ( "pause" ); } } int Manage::server() { int n, k = 0; while (1) { system ( "cls" );; cout << "\n\n\n" << "※※※※※※※※※※※※※※※※※※※※※※※※※\n" << "※ ※\n" << "※ 选修课系统管理端 ※\n" << "※ ※\n" << "※ 操作方式: ※\n" << "※ 1.增加学生 2.增加课程 ※\n" << "※ 3.删除学生 4.删除课程 ※\n" << "※ 5.填写成绩 6.更改学分 ※\n" << "※ 7.学生情况 8.选课情况 ※\n" << "※ 9.保存数据 0.退出系统 ※\n" << "※ ※\n" << "※※※※※※※※※※※※※※※※※※※※※※※※※\n" << endl; cout << "\t\t 请选择操作方式: " << endl; cin >> n; if (n > -1 && n < 10) return n; else { cerr << "\n\t\t\t\t输入有误!\n" << endl; k++; } if (k == 3) { cerr << "错误输入超过三次!\n" ; return 0; } system ( "pause" ); } } Student* Manage::password1() { system ( "cls" ); int k = 0; int num; while (1) { cout << "请输入你的学号:" << endl; cin >> num; Student*p = FindStu(num); if (p == NULL) { cout << "无此学号!!请重新输入 " << endl; k++; system ( "pause" ); } else { cout << "你的名字为:" << p->GetName() << endl; cout << "请按任意键进入选课系统" << endl; return p; } if (k >= 3) { system ( "cls" ); cerr << "\n\n\t\t\t输入错误密码超过三次!请按任意键退出.." << endl; return NULL; } } } //密码检查 bool Manage::password2() { int k = 0, i; const char A[] = "admin" ; char B[10]; system ( "cls" ); for (i = 0; i < 8; i++) cout << endl; while (1) { printf ( "\t\t\t请输入管理员密码:" ); i = 0; cin >> B; if ( strcmp (A, B) == 0) return true ; else { k++; cerr << "\n\n\t\t\t密码输入错误!请重新输入!\n" << endl; system ( "pause" ); } if (k ==3) { system ( "cls" ); cerr << "\n\n\t\t\t输入错误密码超过三次!请按任意键退出.." << endl; return false ; } } } void Manage::Start() { int n = 1; while (n) { n = menu(); if (n == 1) { Student*p = password1(); while (p) { int c = custom(); switch (c) { case 1: menu_1_1(p); break ; //学生选课 case 2:p->ShowStuInfo(); break ; //学生情况 case 3:ShowStuSubInfo(p);; break ; //选课情况 } IsUpdate(); if (c == 4) break ; //退出系统 } if (p == NULL) n = 0; } else if (n == 2) { bool t = password2(); while (t) { int c = server(); switch (c) { case 1:menu_2_1(); break ; //增加学生 case 2:menu_2_2(); break ; //增加课程 case 3: menu_2_3(); break ; //删除学生 case 4:menu_2_4(); break ; //删除课程 case 5: menu_2_5(); break ; //填写成绩 case 6: menu_2_6(); break ; //更改学分 case 7:menu_2_7(); break ; //学生情况 case 8:menu_2_8(); break ; //选课情况 case 9: menu_2_9(); break ; //保存数据 } IsUpdate(); if (c == 0) break ; //退出系统 } if (!t) n = 0; } } } //学生端功能函数 void Manage::menu_1_1(Student*p) //学生选课 { if (p->IsFull()) cout << "你的课程已经选满了" << endl; else { int num; if (ShowSub()==0) cout << "无课程可以选择" << endl; else { cout << "请输入你的选择" << endl; cin >> num; if (p->FindSub(num)) cout << "此课程你已经选择" << endl; else if (FindSub(num)->IsFull()) cout << "课程人数已满" << endl; else { p->AddSub(num); FindSub(num)->AddStu(p->GetNum()); cout << "选课成功" << endl; } } } Update = true ; system ( "pause" ); } void Manage::ShowStuSubInfo(Student*p) { SubList*l = p->GetSubPtr()->next; cout << p->GetNum() << " " << p->GetName() << " 选课数" << p->GetFactSubNum() << endl; while (l) { Subject*s = FindSub(l->num); cout << "\t\t" << s->GetNum() << " " << s->GetName() << " " << s->GetCredit() << endl; float f = s->GetStuScore(p->GetNum()); cout << "\t\t 成绩 " << f << endl; cout << "------------------------------" << endl; l = l->next; } } //管理端功能函数 void Manage::menu_2_1() //增加学生 { system ( "cls" ); int num; char name[20]; cout << "\n\n\t\t\t\t增加学生操作\n" << endl; cout << "\n\n\t\t请输入学生学号:" ; cin >> num; if (FindStu(num)) cout << "学生已经存在" << endl; else { cout << "\n\n\t\t请输入学生姓名:" ; cin >> name; Student*p = new Student(); p->SetNum(num); p->SetName(name); Student *root = StuRoot; while (root->next) root = root->next; root->next = p; cout << endl << "\t\t增加学生操作成功,按任意键继续" << endl; } system ( "pause" ); } void Manage::menu_2_2() //增加课程 { system ( "cls" ); int num; float credit; char name[20]; cout << "\n\n\t\t\t\t增加课程操作\n" << endl; cout << "\n\n\t\t 请输入课程代号:" ; cin >> num; if (FindSub(num)) cout << "\n\t\t此课程已经存在,按任意键继续" << endl; else { cout << "\n\n\t\t请输入课程名:" ; cin >> name; cout << "请输入课程学分" << endl; cin >> credit; Subject*p = new Subject(); p->SetNum(num); p->SetName(name); p->SetCredit(credit); Subject *root = SubRoot; while (root->next) root = root->next; root->next = p; cout << endl << "\t\t增加课程操作成功,按任意键继续" << endl; } system ( "pause" ); } void Manage::menu_2_3() //删除学生 { system ( "cls" ); cout << "\n\n\t\t\t\t删除学生操作" << endl; if (ShowStu()==0) cout << "无学生" << endl; else { int num; cout << "\n\t请输入要删除的学生代学号:" ; cin >> num; Student*p = FindStu(num); if (p == NULL) cout << "无此学生" << endl; else { DelStu(p); cout << "\n\t\t删除学生操作成功,按任意键继续.." << endl; } } system ( "pause" ); } void Manage::menu_2_4() //删除课程 { system ( "cls" ); cout << "\n\n\t\t\t\t删除课程操作" << endl; if (ShowSub()==0) cout << "无课程" << endl; else { int num; cout << "\n\t请输入要删除的课程代号:" ; cin >> num; Subject*p = FindSub(num); if (p == NULL) cout << "无此课程" << endl; else { DelSub(p); cout << "\n\t\t删除课程操作成功,按任意键继续.." << endl; } } system ( "pause" ); } void Manage::menu_2_5() //填写成绩 { system ( "cls" ); cout << "\n\n\t\t\t\t 填写成绩操作\n" << endl; if (ShowSub()==0) cout << "\n\n\n\t\t对不起,暂时没有任何选修课程。请按任意键继续.." << endl; else { int num; cout << "请选择课程代号" << endl; cin >> num; Subject*p = FindSub(num); if (p == NULL) cerr << "\n\t\t没有此课程!!请按任意键继续.." << endl; else { cout << p->GetNum() << " 课程名称" << p->GetName() << " 选课人数" << p->GetFactStuNum() << endl; int n; cout << "请输入1确认开始填写成绩,按其他键退出" << endl; cin >> n; if (n == 1) { StuList*q = p->GetStuPtr()->next; while (q) { Student*l = FindStu(q->num); cout << "\n\n\t\t请填写" << q->num << " " << l->GetName() << "的学生成绩\n" << endl; cin >> q->score; l->SetUpdate( true ); q = q->next; } p->SetUpdate( true ); } } } Update = true ; system ( "pause" ); } void Manage::menu_2_6() //更改学分 { system ( "cls" ); cout << "\n\n\n\t\t\t\t更改学分操作\n" << endl; if (ShowSub()==0) cout << "\n\n\n\t\t对不起,暂时没有任何课程。请按任意键继续.." << endl; else { int num; cout << "请选择课程代号" << endl; cin >> num; Subject*p = FindSub(num); if (p == NULL) cout << "无此课程" << endl; else { float n; cout << "\n\t\t\t原来学分为:" << p->GetCredit() << endl; cout << "\n\t\t\t现要更改为:" ; cin >> n; p->SetCredit(n); StuList*q = p->GetStuPtr()->next; while (q) { FindStu(q->num)->SetUpdate( true ); q = q->next; } cout << "\n\t\t更改课程学分成功,按任意键继续" << endl; } } Update = true ; system ( "pause" ); } void Manage::menu_2_7() { Student *p = StuRoot->next; if (p == NULL) cout << "无记录" << endl; else while (p) { ShowStuSubInfo(p); p = p->next; } system ( "pause" ); } void Manage::menu_2_8() //选课情况 { system ( "cls" ); cout << "\n\n\t\t\t\t选课情况操作" << endl; if (ShowSub()==0) cout << "\n\n\n\t\t对不起,暂时没有课程!!请按任意键继续.." << endl; else { int num; cout << "\n\t请输入要查看的课程代号:" ; cin >> num; Subject*p = FindSub(num); if (p == NULL) cout << "\n\t\t无此课程!!\t请按任意键继续.." << endl; else { cout << p->GetNum() << " " << p->GetName() << " " << p->GetCredit() << endl; cout << "\t\t最大人数:" << p->GetMaxStuNum() << " " << "实际人数" << p->GetFactStuNum() << endl; StuList*q = p->GetStuPtr()->next; while (q) { cout <<q->num << " " << FindStu(q->num)->GetName() << " " << q->score << endl; q = q->next; } } } system ( "pause" ); } /*保存数据 不过没有读取函数 这个功能就没有 读取懒的写了... */ void Manage::menu_2_9() { Student*p = StuRoot->next; ofstream o( "Student.txt" ,32); ofstream oo( "SubList.txt" , 32); while (p) { SubList*t=p->GetSubPtr()->next; o.write( reinterpret_cast < char *>(p), sizeof (*p)); while (t) { oo.write( reinterpret_cast < char *>(t), sizeof (*t)); t = t->next; } p = p->next; } o.close(); oo.close(); Subject*q = SubRoot->next; o.open( "Subject.txt" , 32); oo.open( "StuList.txt" , 32); while (q) { StuList*t = q->GetStuPtr()->next; o.write( reinterpret_cast < char *>(q), sizeof (*q)); while (t) { oo.write( reinterpret_cast < char *>(t), sizeof (*t)); t = t->next; } q = q->next; } o.close(); oo.close(); cout << "\n\n\n\t\t\t保存数据成功!按任意键继续.." << endl; system ( "pause" ); } int main() { Manage m; m.Start(); return 0; } |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。