-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaltermovieUI.cpp
118 lines (115 loc) · 3.08 KB
/
altermovieUI.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
#include <stdio.h>
#include "struct.h"
#include <conio.h>
#include <windows.h>
void altermovieBLL(int n,int month,int day,int hour,int room);
nodemovie * getfilemovie();
int roomcheck(int room);
//修改电影排挡UI函数
void altermovieUI(){
int i=1,n,month,day,room,hour;
system("cls");
printf("********************************************************************\n");
printf("**************************欢迎光临银河影院**************************\n\n\n");
printf("\033[40;35m 修改影片演出计划\n\033[0m");
printf(" 全部计划\n");
printf(" _____________________________________________________________\n");
printf(" 电影名称 ID 上映时间 影厅\n");
//调用电影文件打开函数 直接访问第三层,打印全部电影排挡数据
nodemovie *head=getfilemovie();
nodemovie *p=head;
p=p->next;
if(p==NULL){
printf(" 当前无演出计划!\n 按任意键返回");
getch();
return;
}
while(p!=NULL){
printf(" %d%12s%14s %d月%2d日%2d时 %d\n",i,p->name,p->id,p->month,p->day,p->hour,p->room);
p=p->next;
i++;
}
printf(" 请输入你想要修改计划的序号:");
while(1){
if(scanf("%d",&n)!=1){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
else if(n>=i||n<=0){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
break;
}
printf(" 请输入你想要修改后的月份、日期时间和影厅(空格间隔):\n");
printf(" ");
while(1){
//判断月份和日期
if(scanf("%d",&month)!=1){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
if(scanf("%d",&day)!=1){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
if(month>12){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12){
if(day>31){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
}
if(month==4||month==6||month==9||month==11){
if(day>30){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
}
if(month==2&&day>29){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
//判断时间是否正确
if(scanf("%d",&hour)!=1){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
else if(hour<0||hour>=24){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
//判断影厅是否存在
if(scanf("%d",&room)!=1){
printf(" 您的输入有误,请重新输入:");
fflush(stdin);
continue;
}
else{//判断影厅是否存在
if(roomcheck(room)==0){//返回0时说明当前已开通影厅中没有这个影厅
printf(" 不存在此影厅,请重新输入:");
fflush(stdin);
continue;
}
}
//走到此处说明数据输入合法
break;
}
altermovieBLL(n,month,day,hour,room);
printf(" 恭喜您成功修改第%d号计划\n 按任意键返回",n);
getch();
return;
}