-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
180 lines (156 loc) · 4.17 KB
/
main.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
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "vipprotect.h"
#include "fileprotect.h"
#include "variable.h"
#include "egg.h"
int MaxSeqLen1,MinSec1,MaxSec1,MinRestSec1,MaxRestSec1,VIPSERVLen1,WaitTime1;
int countG=0,countV=0,countR=0;
int normServeLen=0,vipServeLen=0;
int size1=3,size2=1;
int timeCount=1;
int ischange=0,close=0,over=0;//分别是打印有变化的信息 收到下班请求 关闭营业厅
int strategy=1;//1为VIP定向服务,2为VIP顺便服务
WINDOW windows[8];
LISTNODEPTR headp=NULL; LISTNODEPTR tailp=NULL;//指向普通客户队列头指针,尾指针
LISTNODEPTR headpVIP=NULL; LISTNODEPTR tailpVIP=NULL;//指向VIP客户队列头指针,尾指针
WINTORESTPTR headpWinRest=NULL; WINTORESTPTR tailpWinRest=NULL;//指向窗口申请休息队列头指针,尾指针
HANDLE hClientMutex;
EVENT_TYPE ev;
int main()
{
int num;
FILE *cfPtr;//vip资料维护
int choice;
int way;
FILE *fPtr1=NULL;//银行营业
FILE *fPtr2=NULL;
FILE *fPtr3=NULL;
FILE *fPtr4=NULL;
FILE *vipPtr=NULL;
// HEGG egg1,egg2;
fileWrite();
printInitial();
fileRead();
initialize();
printf("\t\t************************************\n\t\t\t 小组201421130205\n\t ***********************************************\t\t\t\t\t\t 欢迎来到全球第一萌的代码美少女银行\n\t\t ***********************************\n\t\t 我们正年轻,我们在路上\n\t\t\t******************\n");
printf("请输入您想进行的任务\n"
"1--vip资料维护\n"
"2--配置文件维护\n"
"3--普通银行开始营业\n"
"4--动画银行开始营业\n");
scanf("%d",&num);
while(num!=3&&num!=4)
{
switch(num)
{
case 1:
while((choice=enterChoice())!=4)
{ /*输入为4时退出*/
switch(choice)
{
case 1:
if((cfPtr=fopen("vip.txt","rb+"))==NULL)
printf("File could not be opened.\n");
else
updateRecord(cfPtr);
break;
case 2:
if((cfPtr=fopen("vip.txt","rb+"))==NULL)
printf("File could not be opened.\n");
else
addRecord(cfPtr);
break;
case 3:
if((cfPtr=fopen("vip.txt","rb+"))==NULL)
printf("File could not be opened.\n");
else
deleteRecord(cfPtr);
break;
}
}
break;
case 2:
fileUpdate(); //配置文件维护
printInitial();
fileRead();
break;
}
printf("请输入您想进行的任务\n"
"1--vip资料维护\n"
"2--配置文件维护\n"
"3--银行开始营业\n"
"4--动画银行开始营业\n");
scanf("%d",&num);
}
if(num==3)
{
printf("请选择输入方式:\n1--文件输入\n2--键盘输入\n");
scanf("%d",&way);
printf("请输入您想进行的策略:\n1--VIP窗口定向服务策略\n2--VIP窗口顺便服务策略\n");
scanf("%d",&strategy);
fileRead();
initialize();
if((fPtr2=fopen("outputDetail.txt","w"))==NULL)//周期性打印
{
printf("destfPtr");
}
else if((fPtr3=fopen("output.txt","w"))==NULL)//状态变化的打印
{
printf("NNN");
}
else if((fPtr4=fopen("统计信息.txt","w"))==NULL)
{
printf("yyy");
}
else
{
if((fPtr1=fopen("input.txt","r"))==NULL)
{
printf("soucefPtr");
}
else if(way==1)
{
bank1(fPtr1,fPtr2,fPtr3,fPtr4);
fclose(fPtr1);
}
else if(way==2)
{
bank2(fPtr2,fPtr3,fPtr4);
}
}
fclose(fPtr2);
fclose(fPtr3);
fclose(fPtr4);
}
else if(num==4)
{
if((fPtr2=fopen("outputDetail.txt","w"))==NULL)//周期性打印
{
printf("destfPtr");
}
else if((fPtr3=fopen("output.txt","w"))==NULL)//状态变化的打印
{
printf("NNN");
}
else if((fPtr4=fopen("统计信息.txt","w"))==NULL)
{
printf("yyy");
}
else
{
EggStart(1300,700);
tietu1();
opendoor();
bank3(fPtr2,fPtr3,fPtr4);
closedoor();
}
fclose(fPtr2);
fclose(fPtr3);
fclose(fPtr4);
fclose(vipPtr);
}
system("pause");
return 0;
}