本文實例為大家分享了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
|
#include<iostream>
#include<fstream>
#include<string>
using
namespace
std;
void
fun1()
{ cout<<
"******************************"
<<endl;
cout<<endl;
cout<<
"******學校運動會管理系統******"
<<endl;
cout<<
"----數據錄入 請按:1----"
<<endl;
cout<<
"----數據修改 請按:2----"
<<endl;
cout<<
"----數據刪除 請按:3----"
<<endl;
cout<<
"----數據查詢 請按:4----"
<<endl;
cout<<
"----數據顯示 請按:5----"
<<endl;
cout<<
"----退出系統 請按:6----"
<<endl;
cout<<endl;
cout<<
"*******************************"
<<endl;
cout<<endl;
cout<<
"*****請輸入一個數據,並按回車鍵!*****"
<<endl;
}
class
Match
{
public
:
Match *next;
//為創建鏈表做准備
int
number;
//比賽項目編號
char
call[10];
//比賽項目名稱
char
time
[10];
//比賽時間
char
place[20];
//比賽地點
friend
void
input1();
};
void
input1()
{ ofstream fout(
"e:\\比賽項目.dat"
,ios::app);
char
ch;
Match a;
do
{ cout<<
"請分別輸入比賽項目編號、名稱、比賽時間、比賽地點."
<<endl;
cin>>a.number>>a.call>>a.place>>a.
time
;
a.next=NULL;
fout.write((
char
*)&a,
sizeof
(Match));
cout<<
"是否繼續輸入,如果繼續鍵入Y|y"
<<endl;
cin>>ch;
}
while
(ch==
'y'
||ch==
'Y'
);
fout.close();
}
Match *head1;
void
creat()
{ head1=NULL;
Match *p,*q=head1;
ifstream fin(
"e:\\比賽項目.dat"
,ios::in);
if
(!fin)
{ cout<<
"文件打開失敗!"
<<endl;
exit
(0);
}
p=
new
Match;
fin.read((
char
*)p,
sizeof
(Match));
while
(!fin.eof())
{
if
(head1==NULL) head1=p;
else
q->next=p;
q=p;
p=
new
Match;
fin.read((
char
*)p,
sizeof
(Match));
}
fin.close();
}
int
change1()
//對比賽項目相關信息修改
{
cout<<
"您正在進行修改比賽項目有關事項操作!"
<<endl;
creat();
Match *p1;
p1=head1;
cout<<
"請輸入要修改比賽項目的編號:"
<<endl;
int
number1;
//要修改的比賽項目編號
int
sign=0;
//設置的標記變量
cin>>number1;
while
(p1!=NULL)
{
if
(p1->number==number1) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要修改的記錄!"
<<endl;
else
{
cout<<
"請選擇要修改比賽項目的那些信息"
<<endl;
cout<<
"------修改比賽項目的編號----1"
<<endl;
cout<<
"------修改比賽項目的名稱----2"
<<endl;
cout<<
"------修改比賽時間----3"
<<endl;
cout<<
"------修改比賽地點----4"
<<endl;
cout<<
"請輸入對應信息的編號"
<<endl;
int
a;
int
nu;
//新的整形數據
char
info[20];
//新的字符數組
cin>>a;
switch
(a)
{
case
1:cout<<
"請輸入新的比賽編號:"
<<endl;
cin>>nu;
p1->number=nu;
cout<<
"比賽項目編號修改成功!"
<<endl;
break
;
case
2:cout<<
"請輸入新的比賽項目名稱:"
<<endl;
cin>>info;
strcpy
(p1->call,info);
cout<<
"比賽項目名稱修改成功!"
<<endl;
break
;
case
3:cout<<
"請輸入新的比賽時間:"
<<endl;
cin>>info;
strcpy
(p1->
time
,info);
cout<<
"比賽項目時間修改成功!"
<<endl;
break
;
case
4:cout<<
"請輸入新的比賽地點:"
<<endl;
cin>>info;
strcpy
(p1->place,info);
cout<<
"比賽項目地點修改成功!"
<<endl;
break
;
}
ofstream fout(
"e:\\比賽項目.dat"
,ios::out);
p1=head1;
while
(p1!=NULL)
{
fout.write((
char
*)p1,
sizeof
(Match));
p1=p1->next;
}
fout.close();
}
return
0;
}
int
delete1()
//對比賽項目相關信息進行刪除
{ creat();
Match *p1,*p2;
p2=p1=head1;
cout<<
"請選擇要刪除比賽項目的那些信息"
<<endl;
cout<<
"------刪除比賽項目的編號----1"
<<endl;
cout<<
"------刪除比賽項目的名稱----2"
<<endl;
cout<<
"請輸入對應信息的編號"
<<endl;
int
n;
cin>>n;
int
num,flag=0;
char
cal[10];
switch
(n)
{
case
1: cin>>num;
while
(p1!=NULL)
{
if
(p1->number==num) {flag=1;
break
;}
p2=p1;
p1= p1->next;
}
if
(flag==0)
cout<<
"沒有找到要刪除的記錄!"
<<endl;
else
p2->next=p1->next;
case
2: cin>>cal;
while
(p1!=NULL)
{
if
(!
strcmp
(p1->call,cal)) {flag=1;
break
;}
p2=p1;
p1= p1->next;
}
if
(flag==0)
cout<<
"沒有找到要刪除的記錄!"
<<endl;
else
p2->next=p1->next;
}
ofstream fout(
"e:\\比賽項目.dat"
,ios::out);
p1=head1;
while
(p1!=NULL)
{
fout.write((
char
*)p1,
sizeof
(Match));
p1=p1->next;
}
fout.close();
return
0;
}
void
print1()
{
creat();
Match *p1=head1;
cout<<
"請分別輸出比賽項目編號、名稱、比賽時間、比賽地點."
<<endl;
while
(p1!=NULL)
{ cout<<p1->number<<
'\t'
<<p1->call<<
'\t'
<<p1->
time
<<
'\t'
<<p1->place<<endl;
p1=p1->next;
}
}
void
find1()
{ creat();
Match *p1;
p1=head1;
int
sign=0;
//設置的標記變量
cout<<
"請選擇要查詢比賽項目的哪些信息"
<<endl;
cout<<
"------按比賽項目的編號查詢----1"
<<endl;
cout<<
"------按比賽項目的名稱查詢----2"
<<endl;
cout<<
"------按比賽時間查詢----3"
<<endl;
cout<<
"------按比賽地點查詢----4"
<<endl;
cout<<
"請輸入對應信息的編號"
<<endl;
int
a;
int
nu;
//查詢整形數據條件
char
info[20];
//查詢字符型數據條件
cin>>a;
switch
(a)
{
case
1:cout<<
"請輸入要查詢的比賽編號:"
<<endl;
cin>>nu;
while
(p1!=NULL)
{
if
(p1->number==nu) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要查詢的記錄!"
<<endl;
else
cout<<p1->number<<
'\t'
<<p1->call<<
'\t'
<<p1->
time
<<
'\t'
<<p1->place<<endl;
break
;
case
2:cout<<
"請輸入要查詢的比賽項目名稱:"
<<endl;
cin>>info;
while
(p1!=NULL)
{
if
(p1->call==info) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要查詢的記錄!"
<<endl;
else
cout<<p1->number<<
'\t'
<<p1->call<<
'\t'
<<p1->
time
<<
'\t'
<<p1->place<<endl;
break
;
case
3:cout<<
"請輸入要查詢的比賽時間:"
<<endl;
cin>>info;
while
(p1!=NULL)
{
if
(!
strcmp
(p1->
time
,info)) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要查詢的記錄!"
<<endl;
else
cout<<p1->number<<
'\t'
<<p1->call<<
'\t'
<<p1->
time
<<
'\t'
<<p1->place<<endl;
break
;
case
4:cout<<
"請輸入要查詢的比賽地點:"
<<endl;
cin>>info;
while
(p1!=NULL)
{
if
(!
strcmp
(p1->place,info)) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要查詢的記錄!"
<<endl;
else
cout<<p1->number<<
'\t'
<<p1->call<<
'\t'
<<p1->
time
<<
'\t'
<<p1->place<<endl;
break
;
}
}
class
Athlete
{
public
:
Athlete *next;
int
number;
//運動員的編號
char
name[10];
//運動員的姓名
char
part[20];
//運動員所屬工作單位或省份
char
sex[20];
//運動員性別
int
age;
//運動員年齡
friend
void
input2();
};
void
input2()
{ ofstream fout(
"e:\\運動員.dat"
,ios::app);
char
ch;
Athlete b;
do
{ cout<<
"請分別輸入運動員編號、姓名、性別、年齡、所屬省份或工作單位."
<<endl;
cin>>b.number>>b.name>>b.sex>>b.age>>b.part;
b.next=NULL;
fout.write((
char
*)&b,
sizeof
(Athlete));
cout<<
"是否繼續輸入,如果繼續鍵入Y|y"
<<endl;
cin>>ch;
}
while
(ch==
'y'
||ch==
'Y'
);
}
Athlete *head4;
void
creat2()
{ head4=NULL;
Athlete *p,*q=head4;
ifstream fin(
"e:\\運動員.dat"
,ios::in);
if
(!fin)
{
cout<<
"文件打開失敗!"
<<endl;
exit
(0);
}
p=
new
Athlete;
fin.read((
char
*)p,
sizeof
(Athlete));
while
(!fin.eof())
{
if
(head4==NULL) head4=p;
else
q->next=p;
q=p;
p=
new
Athlete;
fin.read((
char
*)p,
sizeof
(Athlete));
}
fin.close();
}
int
change2()
//對運動員相關信息修改
{
cout<<
"您正在進行修改運動員基本信息操作!"
<<endl;
creat2();
Athlete *p1;
p1=head4;
cout<<
"請輸入要修改運動員的編號:"
<<endl;
int
number1;
//要修改的運動員編號
int
sign=0;
//設置的標記變量
cin>>number1;
while
(p1!=NULL)
{
if
(p1->number==number1) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要修改的記錄!"
<<endl;
else
{
cout<<
"請選擇要修改運動員的哪些信息"
<<endl;
cout<<
"------修改運動員的編號----1"
<<endl;
cout<<
"------修改運動員的姓名----2"
<<endl;
cout<<
"------修改運動員所屬工作單位或省份----3"
<<endl;
cout<<
"------修改運動員性別----4"
<<endl;
cout<<
"------修改運動員年齡----4"
<<endl;
cout<<
"請輸入對應信息的編號"
<<endl;
int
a;
int
nu;
//新的整形數據
char
info[20];
//新的字符數組
cin>>a;
switch
(a)
{
case
1:cout<<
"請輸入新的運動員編號:"
<<endl;
cin>>nu;
p1->number=nu;
cout<<
"運動員的編號修改成功!"
<<endl;
break
;
case
2:cout<<
"請輸入新的運動員姓名:"
<<endl;
cin>>info;
strcpy
(p1->name,info);
cout<<
"運動員姓名修改成功!"
<<endl;
break
;
case
3:cout<<
"請輸入新的運動員所屬工作單位或省份:"
<<endl;
cin>>info;
strcpy
(p1->part,info);
cout<<
"運動員所屬工作單位或省份修改成功!"
<<endl;
break
;
case
4:cout<<
"請輸入新的性別:"
<<endl;
cin>>info;
strcpy
(p1->sex,info);
cout<<
"運動員性別修改成功!"
<<endl;
break
;
case
5:cout<<
"請輸入新的年齡:"
<<endl;
cin>>nu;
p1->age=nu,
cout<<
"運動員年齡修改成功!"
<<endl;
break
;
}
ofstream fout(
"e:\\運動員.dat"
,ios::out);
p1=head4;
while
(p1!=NULL)
{
fout.write((
char
*)p1,
sizeof
(Athlete));
p1=p1->next;
}
fout.close();
}
return
0;
}
int
delete2()
//對運動員相關信息進行刪除
{ creat2();
Athlete *p1,*p2;
p2=p1=head4;
cout<<
"請選擇要刪除運動員的哪些信息"
<<endl;
cout<<
"------刪除運動員的編號----1"
<<endl;
cout<<
"------刪除運動員的姓名----2"
<<endl;
cout<<
"請輸入對應信息的編號"
<<endl;
int
n;
cin>>n;
int
num,flag=0;
char
na[10];
switch
(n)
{
case
1: cin>>num;
while
(p1!=NULL)
{
if
(p1->number==num) {flag=1;
break
;}
p2=p1;
p1= p1->next;
}
if
(flag==0)
cout<<
"沒有找到要刪除的記錄!"
<<endl;
else
p2->next=p1->next;
case
2: cin>>na;
while
(p1!=NULL)
{
if
(!
strcmp
(p1->name,na)) {flag=1;
break
;}
p2=p1;
p1= p1->next;
}
if
(flag==0)
cout<<
"沒有找到要刪除的記錄!"
<<endl;
else
p2->next=p1->next;
}
ofstream fout(
"e:\\運動員.dat"
,ios::out);
p1=head4;
while
(p1!=NULL)
{
fout.write((
char
*)p1,
sizeof
(Athlete));
p1=p1->next;
}
fout.close();
return
0;
}
void
find2()
{ creat2();
Athlete *p1;
p1=head4;
int
sign=0;
//設置的標記變量
cout<<
"請選擇要查詢運動員的哪些信息"
<<endl;
cout<<
"------按運動員的編號查詢----1"
<<endl;
cout<<
"------按運動員的姓名查詢----2"
<<endl;
cout<<
"請輸入對應信息的編號"
<<endl;
int
a;
int
nu;
//查詢整形數據條件
char
info[20];
//查詢字符型數據條件
cin>>a;
switch
(a)
{
case
1:cout<<
"請輸入要查詢的運動員編號:"
<<endl;
cin>>nu;
while
(p1!=NULL)
{
if
(p1->number==nu) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要查詢的記錄!"
<<endl;
else
cout<<p1->number<<
'\t'
<<p1->name<<
'\t'
<<p1->part<<
'\t'
<<p1->sex<<
'\t'
<<p1->age<<endl;
break
;
case
2:cout<<
"請輸入要查詢的運動員姓名:"
<<endl;
cin>>info;
while
(p1!=NULL)
{
if
(p1->name==info) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要查詢的記錄!"
<<endl;
else
cout<<p1->number<<
'\t'
<<p1->name<<
'\t'
<<p1->part<<
'\t'
<<p1->sex<<
'\t'
<<p1->age<<endl;
break
;
}
}
void
print2()
{
creat2();
Athlete *p1=head4;
cout<<
"請分別輸出運動員編號、姓名、所屬省份或工作單位、性別、年齡."
<<endl;
while
(p1!=NULL)
{ cout<<p1->number<<
'\t'
<<p1->name<<
'\t'
<<p1->part<<
'\t'
<<p1->sex<<
'\t'
<<p1->age<<endl;
p1=p1->next;
}
}
class
Message
{
public
:
Message *next;
char
name[10];
//運動員姓名
char
avent[10];
//運動員參加的某比賽項目名稱
int
score ;
//成績
int
ca;
//名次
friend
void
input3();
};
void
input3()
{ ofstream fout(
"e:\\比賽賽事.dat"
,ios::app);
char
ch;
Message c;
do
{ cout<<
"請分別輸入參賽運動員姓名、比賽名稱、比賽成績、比賽名次."
<<endl;
cin>>c.name>>c.avent>>c.score>>c.ca;
c.next=NULL;
fout.write((
char
*)&c,
sizeof
(Message));
cout<<
"是否繼續輸入,如果繼續鍵入Y|y"
<<endl;
cin>>ch;
}
while
(ch==
'y'
||ch==
'Y'
);
fout.close();
}
Message *head7;
void
creat3()
{ head7=NULL;
Message *p,*q=head7;
ifstream fin(
"e:\\比賽賽事.dat"
,ios::in);
if
(!fin)
{
cout<<
"文件打開失敗!"
<<endl;
exit
(0);
}
p=
new
Message;
fin.read((
char
*)p,
sizeof
(Message));
while
(!fin.eof())
{
if
(head7==NULL) head7=p;
else
q->next=p;
q=p;
p=
new
Message;
fin.read((
char
*)p,
sizeof
(Message));
}
fin.close();
}
int
change3()
//修改比賽賽事信息
{ cout<<
"您正在進行修改比賽賽事有關事項操作!"
<<endl;
creat3();
Message *p1;
p1=head7;
cout<<
"請輸入參賽運動員姓名及參賽項目名稱! "
<<endl;
char
na[20];
char
info[20];
int
sign=0;
//設置的標記變量
cin>>na>>info;
while
(p1!=NULL)
{
if
((p1->name==na)&&(p1->avent==info)) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要修改的記錄!"
<<endl;
else
{
cout<<
"請選擇要修改比賽賽事的哪些信息"
<<endl;
cout<<
"------修改參賽運動員的姓名----1"
<<endl;
cout<<
"------修改比賽項目的名稱----2"
<<endl;
cout<<
"------修改比賽成績----3"
<<endl;
cout<<
"------修改比賽名次----4"
<<endl;
cout<<
"請輸入對應信息的編號"
<<endl;
int
a;
int
nu;
//新的整形數據
char
info[20];
//新的字符數組
cin>>a;
switch
(a)
{
case
1:cout<<
"請輸入新的參賽運動員姓名:"
<<endl;
cin>>info;
strcpy
(p1->name,info);
cout<<
"參賽運動員姓名修改成功!"
<<endl;
break
;
case
2:cout<<
"請輸入新的比賽項目名稱:"
<<endl;
cin>>info;
strcpy
(p1->avent,info);
cout<<
"比賽項目名稱修改成功!"
<<endl;
break
;
case
3:cout<<
"請輸入新的比賽成績:"
<<endl;
cin>>nu;
p1->score=nu;
cout<<
"比賽項目成績修改成功!"
<<endl;
break
;
case
4:cout<<
"請輸入新的比賽名次:"
<<endl;
cin>>nu;
p1->ca=nu;
cout<<
"比賽名次修改成功!"
<<endl;
break
;
}
ofstream fout(
"e:\\比賽賽事.dat"
,ios::out);
p1=head7;
while
(p1!=NULL)
{
fout.write((
char
*)p1,
sizeof
(Message));
p1=p1->next;
}
fout.close();
}
return
0;
}
int
delete3()
//對比賽賽事相關信息進行刪除
{ creat3();
Message *p1,*p2;
p2=p1=head7;
cout<<
"請輸入要刪除的參賽運動員姓名及比賽項目名稱:"
<<endl;
int
flag=0;
char
na[20];
char
info[20];
cin>>na>>info;
while
(p1!=NULL)
{
if
((p1->name==na)&&(p1->avent==info)) {flag=1;
break
;}
p2=p1;
p1= p1->next;
}
if
(flag==0)
cout<<
"沒有找到要刪除的記錄!"
<<endl;
else
p2->next=p1->next;
ofstream fout(
"e:\\比賽賽事.dat"
,ios::out);
p1=head7;
while
(p1!=NULL)
{
fout.write((
char
*)p1,
sizeof
(Message));
p1=p1->next;
}
fout.close();
return
0;
}
void
print3()
{
creat3();
Message *p1=head7;
cout<<
"請分別輸出比賽參賽運動員姓名、比賽項目名稱、比賽成績、比賽名次."
<<endl;
while
(p1!=NULL)
{ cout<<p1->name<<
'\t'
<<p1->avent<<
'\t'
<<p1->score<<
'\t'
<<p1->ca<<endl;
p1=p1->next;
}
}
void
find3()
{ creat3();
Message *p1;
p1=head7;
int
sign=0;
//設置的標記變量
cout<<
"請輸入要查詢的參賽運動員姓名和比賽項目名稱! "
<<endl;
char
na[20];
char
info[20];
//查詢字符型數據條件
cin>>na>>info;
while
(p1!=NULL)
{
if
((p1->name==na)&&(p1->avent==info)) {sign=1;
break
;}
p1= p1->next;
}
if
(sign==0)
cout<<
"沒有找到要查詢的記錄!"
<<endl;
else
cout<<p1->name<<
'\t'
<<p1->avent<<
'\t'
<<p1->score<<
'\t'
<<p1->ca<<endl;
}
int
find()
//進行查找
{
cout<<endl;
cout<<
"\t\t\t請輸入要查詢的信息:"
<<endl;
cout<<
"\t\t比賽項目信息查詢 請按:1"
<<endl;
cout<<
"\t\t運動員信息查詢 請按:2"
<<endl;
cout<<
"\t\t比賽賽事信息查詢 請按:3"
<<endl;
int
j;
cin>>j;
switch
(j)
{
case
1:find1();
break
;
case
2:find2();
break
;
case
3:find3();
break
;
default
:cout<<
"輸入數據有誤!"
<<endl;
}
return
0;
}
int
input()
{
cout<<endl;
cout<<
"\t\t\t請輸入要輸入的信息:"
<<endl;
cout<<
"\t\t比賽項目信息輸入 請按:1"
<<endl;
cout<<
"\t\t運動員信息輸入 請按:2"
<<endl;
cout<<
"\t\t比賽賽事信息輸入 請按:3"
<<endl;
int
j;
cin>>j;
switch
(j)
{
case
1:input1();
break
;
case
2:input2();
break
;
case
3:input3();
break
;
default
:cout<<
"輸入數據有誤!"
<<endl;
}
return
0;
}
int
print()
{
cout<<endl;
cout<<
"\t\t\t請輸入要顯示輸出的信息:"
<<endl;
cout<<
"\t\t比賽項目信息顯示輸出 請按:1"
<<endl;
cout<<
"\t\t運動員信息顯示輸出 請按:2"
<<endl;
cout<<
"\t\t比賽賽事信息顯示輸出 請按:3"
<<endl;
int
j;
cin>>j;
switch
(j)
{
case
1:print1();
break
;
case
2:print2();
break
;
case
3:print3();
break
;
default
:cout<<
"輸入數據有誤!"
<<endl;
}
return
0;
}
int
change()
{
cout<<endl;
cout<<
"\t\t\t請輸入要修改的信息:"
<<endl;
cout<<
"\t\t比賽項目信息修改 請按:1"
<<endl;
cout<<
"\t\t運動員信息修改 請按:2"
<<endl;
cout<<
"\t\t比賽賽事信息修改 請按:3"
<<endl;
int
j;
cin>>j;
switch
(j)
{
case
1:change1();
break
;
case
2:change2();
break
;
case
3:change3();
break
;
default
:cout<<
"輸入數據有誤!"
<<endl;
}
return
0;
}
int
deleted()
{
cout<<endl;
cout<<
"\t\t\t請輸入要刪除的信息:"
<<endl;
cout<<
"\t\t比賽項目信息刪除 請按:1"
<<endl;
cout<<
"\t\t運動員信息刪除 請按:2"
<<endl;
cout<<
"\t\t比賽賽事信息刪除 請按:3"
<<endl;
int
j;
cin>>j;
switch
(j)
{
case
1:delete1();
break
;
case
2:delete2();
break
;
case
3:delete3();
break
;
default
:cout<<
"輸入數據有誤!"
<<endl;
}
return
0;
}
int
main()
{
int
i;
do
{
fun1();
cin>>i;
switch
(i)
{
case
1:input();
break
;
case
2:change();
break
;
case
3:deleted();
break
;
case
4:find();
break
;
case
5: print();
break
;
case
6:
return
0;
default
:cout<<
"您輸入數據有誤!"
<<endl;
}
}
while
(1);
return
0;
}
|