-
Notifications
You must be signed in to change notification settings - Fork 0
/
daniel.rtf
258 lines (258 loc) · 6.86 KB
/
daniel.rtf
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
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Riched20 10.0.19041}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang9 main(); \}\par
\par
case '2':\par
\{\par
body_printer("deleted");\par
usleep(500000);\par
customer_no--;\par
for (int i=id;i<=customer_no;i++)\par
\{\par
customer_info[i]=customer_info[i+1];\par
\}\par
for (int i=1;i<=customer_no;i++ )\par
\{\par
\par
file<<customer_info[i].name <<" "<<customer_info[i].id<<" "<<customer_info[i].phone_no<<" "<<endl;\par
\par
\}\par
file.close();\par
main();\par
\}\par
\par
default:\par
main();\par
\}\par
\par
break ;\par
\}\par
\par
default:\par
main();\par
\}\par
\}\par
\par
case '8':\par
\{\par
system("cls");\par
title_printer("vehicle list");\par
body_printer("choose a way to sort the list");\par
body_printer("press 1,for ascending order");\par
body_printer("press 2,for descending order");\par
char op1;\par
op1=getch();\par
switch(op1)\par
\{\par
\par
case '1' :\par
\{\par
system("cls");\par
int count1=vehicle_no-1;\par
int count2=0;\par
for(int i=1;i<=vehicle_no;i++)\par
\{\par
for(int j=1;j<=vehicle_no;j++)\par
\{\par
if (strcmpi(vehicle_info[i].name,vehicle_info[j].name) <0)\par
count2++;\par
\}\par
if (count2 >= count1)\par
\{\par
\par
vehicle_table_printer(vehicle_info[i]);\par
count1--;\par
\}\par
\}\par
\par
\}\par
break ;\par
\par
case '2':\par
system("cls");\par
int count1=vehicle_no-1;\par
int count2=0;\par
for(int i=1;i<=vehicle_no;i++)\par
\{\par
for(int j=1;j<=vehicle_no;j++)\par
\{\par
if (strcmpi(vehicle_info[i].name,vehicle_info[j].name) >0)\par
count2++;\par
\}\par
if (count2 >= count1)\par
\{\par
\par
vehicle_table_printer(vehicle_info[i]);\par
count1--;\par
\}\par
\}\par
\par
break;\par
\par
\}\par
body_printer("press 1,to search");\par
body_printer("press 2,to select vehicles");\par
body_printer("press any key,to return to the starting screen");\par
op1=getch();\par
switch (op1)\par
\{\par
case '1':\par
\{\par
system("cls");\par
body_printer("search with ");\par
body_printer(" 1, vehicle name ");\par
body_printer(" 2, vehicle type ");\par
body_printer(" 3, vehicle id ");\par
char op2;\par
op2=getch();\par
system("cls");\par
body_printer("enter key word ");\par
\par
switch(op2)\par
\{\par
case '1':\par
\{\par
string name ;\par
cin>>name;\par
for (int i=1;i<=vehicle_no;i++)\par
\{\par
if (vehicle_info[i].name==name)\par
vehicle_table_printer(vehicle_info[i]);\par
\}\par
break;\}\par
case '2':\par
\{\par
string type ;\par
cin>>type;\par
for (int i=1;i<=vehicle_no;i++)\par
\{\par
if (vehicle_info[i].type==type)\par
vehicle_table_printer(vehicle_info[i]);\par
\}\par
break;\}\par
case '3':\par
\{\par
int id ;\par
cin>>id;\par
for (int i=1;i<=vehicle_no;i++)\par
\{\par
if (vehicle_info[i].id==id)\par
vehicle_table_printer(vehicle_info[i]);\par
\}\par
break; \}\par
\}\par
\par
\}\par
case '2':\par
\{\par
body_printer("enter the corresponding id of the vehicle you want to select");\par
body_printer(" or enter 0 to return to the starting screen");\par
int id ;\par
cin>>id;\par
if (id==0)\par
main();\par
system("cls");\par
body_printer("press 1,to modify this vehicle");\par
body_printer("press 2,to delete this vehicle ");\par
body_printer("press any other key to return to the starting page");\par
char op3;\par
op3=getch();\par
switch(op3)\par
\{\par
case '1':\par
\{\par
system("cls");\par
body_printer("enter the name of the vehicle");\par
cin>>vehicle_info[id].name;\par
body_printer("enter the type of the vehicle");\par
cin>>vehicle_info[id].type;\par
body_printer("enter the price per day of the vehicle");\par
cin>>vehicle_info[id].price;\par
body_printer("enter the plate no of the vehicle");\par
cin>>vehicle_info[id].plate_no;\par
body_printer("is the vehicle available for rent(1,for available 2,for unavailable)");\par
cin>>vehicle_info[id].availablity;\par
file.open("vehicle_info.txt",ios::out);\par
for (int i=1;i<=vehicle_no;i++ )\par
\{\par
\par
file<<vehicle_info[i].name <<" "<<vehicle_info[i].type<<" "<<vehicle_info[i].price<<" "<< vehicle_info[i].plate_no<<" "<< vehicle_info[i].availablity<<" "<<vehicle_info[i].id<<" "<<endl;\par
\par
\}\par
file.close();\par
main(); \}\par
\par
case '2':\par
\{\par
body_printer("deleted");\par
usleep(500000);\par
vehicle_no--;\par
for (int i=id;i<=vehicle_no;i++)\par
\{\par
vehicle_info[i]=vehicle_info[i+1];\par
\}\par
for (int i=1;i<=vehicle_no;i++ )\par
\{\par
\par
file<<vehicle_info[i].name <<" "<<vehicle_info[i].type<<" "<<vehicle_info[i].price<<" "<< vehicle_info[i].plate_no<<" "<< vehicle_info[i].availablity<<" "<<vehicle_info[i].id<<" "<<endl;\par
\par
\}\par
file.close();\par
main();\par
\}\par
\par
default:\par
main();\par
\}\par
\par
break ;\par
\}\par
\par
default:\par
main();\par
\}\par
\}\par
case '0':\par
break;\par
case '9':\par
\{\par
system("cls");\par
body_printer("select the type of archive you want to erase");\\\par
body_printer("1, customer archive");\par
body_printer("2, vehicle archive");\par
body_printer("3, registry archive");\par
char choice;\par
choice=getch();\par
switch(choice)\par
\{\par
case '1':\par
customer_no=0;\par
file.open("customer_info.txt",ios::out);\par
break;\par
case '2':\par
vehicle_no=0;\par
file.open("vehicle_info.txt",ios::out);\par
break;\par
\par
case '3':\par
registry_no=0;\par
file.open("registry_info.txt",ios::out);\par
break;\par
\}\par
body_printer("deleted");\par
usleep(500000);\par
\par
\}\par
default:\par
main();\par
\}\par
file.open("numbers.txt",ios::out);\par
file<<vehicle_no<<" "<<customer_no<<" "<<registry_no<<" "<<service_no;\par
file.close();\par
\par
\par
\par
\par
\}\par
}