repl.it
@SofhinWong1/

Farhan Atta

C

No description

fork
loading
Files
  • main.c
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
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
#include <stdio.h>
#include <conio.h>
#include <string>
 using namespace std;

int main()
{ int choice;
/*all veriables for A2 block*/
  string A2_name[100];
  int A2_ID[100], A2_room[100] ,A2_bill_final[100];
  int A2_net, A2_laundry, ch, A2_r_number, A2_week, A2_bill, A2_rent, A2_count, A2_total ;
  char A2_net_t , A2_laundry_t;
/*all veriables for A2 block*/  


/*all veriables for A3 block*/
  string A3_name[100];
  int A3_ID[100], A3_room[100] ,A3_bill_final[100];
  int A3_net, A3_laundry, A3_r_number, A3_week, A3_bill, A3_rent, A3_count, A3_total ;
  char A3_net_t , A3_laundry_t;
/*all veriables for A3 block*/

/*all veriables for B2 block*/
  string B2_name[100];
  int B2_ID[100], B2_room[100] ,B2_bill_final[100];
  int B2_net, B2_laundry, B2_r_number, B2_week, B2_bill, B2_rent, B2_count, B2_total ;
  char B2_net_t , B2_laundry_t;
/*all veriables for B2 block*/


/*all veriables for B3 block*/
  string B3_name[100];
  int B3_ID[100], B3_room[100] ,B3_bill_final[100];
  int B3_net, B3_laundry, B3_r_number, B3_week, B3_bill, B3_rent, B3_count, B3_total ;
  char B3_net_t , B3_laundry_t;
/*all veriables for B3 block*/


  int temp_room_rent, temp_net,temp_laundry , s_choice, p_choice, BR;
    
  A2_rent=200;
  A3_rent=150;
  B2_rent=200;
  B3_rent=150;
  
  
  for(int temp=0;temp<=100;temp++){
  	A2_room[temp]=0;
  	A3_room[temp]=0;
  	B2_room[temp]=0;
  	B3_room[temp]=0;
  	temp_room_rent=0;
  	temp_net=0;
  	temp_laundry=0;
  	A2_total=0;
  	A3_total=0;
  	B2_total=0;
  	B3_total=0;
  }
    
A:    
    printf(" Press 1 to book room for boys\n Press 2 to book room for girls\n Press 3 for search room\n Press 4 for print bill \nPress 5 for exit\n Enter your choice:");
    scanf("%d",& choice);
    /*coppy*/
    if(choice==1){
        A2_B:
        printf(" Press 1 for single bed room of A1 block\n Press 2 for double beded room of A2 block\n Press 3 for triple beded room of A3 block\n Press 4 for four beded room of A4 block\n Press 5 for main menu\n Enter your choice:");
        scanf("%d", &ch);
            if(ch==1)
            {
                printf("sorry due to construction delay this block is unavailable for booking!\n Press any key to go back\n");
                getch();
                goto A2_B;
            }
            if(ch==2)
            {   A2:
            	printf("Enter room number you want to book:");
            	scanf("%d",& A2_r_number);
            	if(A2_room[A2_r_number]==1){
            		printf("Room is already booked chose an other!\n");
            		getch();
            		goto A2;
				}
				if(A2_room[A2_r_number]==0){
					printf("\nEnter the ID of student:");
					scanf("%d", &A2_ID[A2_r_number]);
					printf("\nEnter the name of student:");
					scanf("%s", &A2_name[A2_r_number]);
					printf("\nEnter the number of weeks that student want to stay:");
					scanf("%d", &A2_week);
					
					printf("\nEnter y (yes) if student want to use internet otherwise enter n (no):");
					scanf("%s", &A2_net_t);
					if(A2_net_t=='y'){
						A2_net=20;
					}
					if(A2_net_t=='n'){
						A2_net=0;
					}
					printf("\nEnter y (yes) if student want to use laundry otherwise enter n(no):");
					scanf("%s", &A2_laundry_t);
					if(A2_laundry_t=='y'){
						A2_laundry=20;
					}
					if(A2_laundry_t=='n'){
						A2_laundry=0;
					}
					
					A2_room[A2_r_number]=1;
					
					temp_room_rent=(A2_rent * A2_week);
					temp_net=(A2_net * A2_week);
					temp_laundry=(A2_laundry * A2_week);
					A2_total= (temp_room_rent + temp_net + temp_laundry);
					

					printf("\n Your bill details is mention below");
					printf("\n Room rent for %d weeks=%d", A2_week, temp_room_rent );
					printf("\n internet rent for %d weeks=%d",  A2_week,  temp_net);
					printf("\n Laundry rent for %d weeks=%d",  A2_week,  temp_laundry);
					A2_bill_final[A2_r_number]=A2_total;
					printf("\n total bill:%d", A2_total );
					A2_bill:
					printf("\nPress 1 to clear bill with cradit card\n Press 2 for clear bill with cash\n");
					scanf("%d",&A2_bill);
					if(A2_bill==1){
						printf("you clear your bill with cradit card\n");
						getch();
						goto A;
					}
					if(A2_bill==2){
						printf("you clear your bill with cash\n");
						getch();
						goto A;
					}
					else{
						printf("please enter right choice!");
						getch();
						goto A2_bill;
					}
				}
                
            }
            
            
            
			if(ch==3)
            {
            	   A3:
            	printf("Enter room number you want to book:");
            	scanf("%d",& A3_r_number);
            	if(A3_room[A3_r_number]==1){
            		printf("Room is already booked chose an other!\n");
            		getch();
            		goto A3;
				}
				if(A3_room[A3_r_number]==0){
					printf("\nEnter the ID of student:");
					scanf("%d", &A3_ID[A3_r_number]);
					printf("\nEnter the name of student:");
					scanf("%s", &A3_name[A3_r_number]);
					printf("\nEnter the number of weaks that student want to stay:");
					scanf("%d", &A3_week);
					
					printf("\nEnter y (yes) if student want to use internet otherwise enter n (no):");
					scanf("%s", &A3_net_t);
					if(A3_net_t=='y'){
						A3_net=15;
					}
					if(A3_net_t=='n'){
						A3_net=0;
					}
					printf("\nEnter y (yes) if student want to use laundry otherwise enter n(no):");
					scanf("%s", &A3_laundry_t);
					if(A3_laundry_t=='y'){
						A3_laundry=20;
					}
					if(A3_laundry_t=='n'){
						A3_laundry=0;
					}
					
					A3_room[A3_r_number]=1;
					
					temp_room_rent=(A3_rent * A3_week);
					temp_net=(A3_net * A3_week);
					temp_laundry=(A3_laundry * A3_week);
					A3_total= (temp_room_rent + temp_net + temp_laundry);
					

					printf("\n Your bill details is mention below");
					printf("\n Room rent for %d weeks=%d", A3_week, temp_room_rent );
					printf("\n internet rent for %d weeks=%d",  A3_week,  temp_net);
					printf("\n Laundry rent for %d weeks=%d",  A3_week,  temp_laundry);
					A2_bill_final[A3_r_number]=A3_total;
					printf("\n total bill:%d", A3_total );
					A3_bill:
					printf("\nPress 1 to clear bill with cradit card\n Press 2 for clear bill with cash\n");
					scanf("%d",&A3_bill);
					if(A3_bill==1){
						printf("you clear your bill with cradit card\n");
						getch();
						goto A;
					}
					if(A3_bill==2){
						printf("you clear your bill with cash\n");
						getch();
						goto A;
					}
					else{
						printf("please enter right choice!");
						getch();
						goto A3_bill;
					}
				}
				 
            }
            
            
            
            if(ch==4)
            {
                printf("sorry due to construction delay this block is unavailable for booking!\n Press any key to go back\n");
                getch();
                goto A2_B;
            }
            if(ch==5)
            {
                getch();
                goto A;
            }
            /*copy*/
    }
    
    
    if(choice==2){
    B2_B:
        printf(" Press 1 for single bed room of B1 block\n Press 2 for double beded room of B2 block\n Press 3 for triple beded room of B3 block\n Press 4 for four beded room of B4 block\n Press 5 for main menu\n Enter your choice:");
        scanf("%d", &ch);
            if(ch==1)
            {
                printf("sorry due to construction delay this block is unavailable for booking!\n Press any key to go back\n");
                getch();
                goto B2_B;
            }
            if(ch==2)
            {   B2:
            	printf("Enter room number you want to book:");
            	scanf("%d",& B2_r_number);
            	if(B2_room[B2_r_number]==1){
            		printf("Room is already booked chose an other!\n");
            		getch();
            		goto B2;
				}
				if(B2_room[B2_r_number]==0){
					printf("\nEnter the ID of student:");
					scanf("%d", &B2_ID[B2_r_number]);
					printf("\nEnter the name of student:");
					scanf("%s", &B2_name[B2_r_number]);
					printf("\nEnter the number of weaks that student want to stay:");
					scanf("%d", &B2_week);
					
					printf("\nEnter y (yes) if student want to use internet otherwise enter n (no):");
					scanf("%s", &B2_net_t);
					if(B2_net_t=='y'){
						B2_net=20;
					}
					if(B2_net_t=='n'){
						B2_net=0;
					}
					printf("\nEnter y (yes) if student want to use laundry otherwise enter n(no):");
					scanf("%s", &B2_laundry_t);
					if(B2_laundry_t=='y'){
						B2_laundry=20;
					}
					if(B2_laundry_t=='n'){
						B2_laundry=0;
					}
					
					B2_room[B2_r_number]=1;
					
					temp_room_rent=(B2_rent * B2_week);
					temp_net=(B2_net * B2_week);
					temp_laundry=(B2_laundry * B2_week);
					B2_total= (temp_room_rent + temp_net + temp_laundry);
					

					printf("\n Your bill details is mention below");
					printf("\n Room rent for %d weeks=%d", B2_week, temp_room_rent );
					printf("\n internet rent for %d weeks=%d",  B2_week,  temp_net);
					printf("\n Laundry rent for %d weeks=%d",  B2_week,  temp_laundry);
					B2_bill_final[B2_r_number] = B2_total;
					printf("\n total bill:%d", B2_total );
					B2_bill:
					printf("\nPress 1 to clear bill with cradit card\n Press 2 for clear bill with cash\n");
					scanf("%d",&B2_bill);
					if(B2_bill==1){
						printf("you clear your bill with cradit card\n");
						getch();
						goto A;
					}
					if(B2_bill==2){
						printf("you clear your bill with cash\n");
						getch();
						goto A;
					}
					else{
						printf("please enter right choice!");
						getch();
						goto B2_bill;
					}
				}
                
            }
            
            
            
			if(ch==3)
            {
            	   B3:
            	printf("Enter room number you want to book:");
            	scanf("%d",& B3_r_number);
            	if(B3_room[B3_r_number]==1){
            		printf("Room is already booked chose an other!\n");
            		getch();
            		goto B3;
				}
				if(B3_room[B3_r_number]==0){
					printf("\nEnter the ID of student:");
					scanf("%d", &B3_ID[B3_r_number]);
					printf("\nEnter the name of student:");
					scanf("%s", &B3_name[B3_r_number]);
					printf("\nEnter the number of weaks that student want to stay:");
					scanf("%d", &B3_week);
					
					printf("\nEnter y (yes) if student want to use internet otherwise enter n (no):");
					scanf("%s", &B3_net_t);
					if(B3_net_t=='y'){
						B3_net=20;
					}
					if(B3_net_t=='n'){
						B3_net=0;
					}
					printf("\nEnter y (yes) if student want to use laundry otherwise enter n(no):");
					scanf("%s", &B3_laundry_t);
					if(B3_laundry_t=='y'){
						B3_laundry=20;
					}
					if(B3_laundry_t=='n'){
						B3_laundry=0;
					}
					
					B3_room[B3_r_number]=1;
					
					temp_room_rent=(B3_rent * B3_week);
					temp_net=(B3_net * B3_week);
					temp_laundry=(B3_laundry * B3_week);
					B3_total= (temp_room_rent + temp_net + temp_laundry);
					

					printf("\n Your bill details is mention below");
					printf("\n Room rent for %d weeks=%d", B3_week, temp_room_rent );
					printf("\n internet rent for %d weeks=%d",  B3_week,  temp_net);
					printf("\n Laundry rent for %d weeks=%d",  B3_week,  temp_laundry);
					A2_bill_final[A3_r_number]=B3_total;
					printf("\n total bill:%d", B3_total );
					B3_bill:
					printf("\nPress 1 to clear bill with cradit card\n Press 2 for clear bill with cash\n");
					scanf("%d",&B3_bill);
					if(B3_bill==1){
						printf("you clear your bill with cradit card\n");
						getch();
						goto A;
					}
					if(B3_bill==2){
						printf("you clear your bill with cash\n");
						getch();
						goto A;
					}
					else{
						printf("please enter right choice!");
						getch();
						goto B3_bill;
					}
				}
				 
            }
            
            
            
            if(ch==4)
            {
                printf("sorry due to construction delay this block is unavailable for booking!\n Press any key to go back\n");
                getch();
                goto B2_B;
            }
            if(ch==5)
            {
                getch();
                goto A;
            }    
    }
    
    
    
    if(choice==3){
    	S:
    	printf("\nPress 1 for A2 block \nPress 2 for A3 block\nPress 3 for B2 block\nPress 4 for B3 block\n Press 5 for main menu\nEnter your choice: ");
        scanf("%d",&s_choice);
        if(s_choice==1){
        	printf("\nFree rooms of A2 block are mention bellow!\n");
        	for(int p=1;p<=100; p++){
        		if(A2_room[p]==0){
        			printf("R%d is free!\n", p);
				}
			}
			printf("\nPress any key to go back to search menu");
			getch();
			goto S;
		}
		if(s_choice==2){
        	printf("\nFree rooms of A3 block are mention bellow!\n");
        	for(int p=1;p<=100; p++){
        		if(A3_room[p]==0){
        			printf("R%d is free!\n", p);
				}
			}
			printf("\nPress any key to go back to search menu");
			getch();
			goto S;
		}
		if(s_choice==3){
        	printf("\nFree rooms of B2 block are mention bellow!\n");
        	for(int p=1;p<=100; p++){
        		if(B2_room[p]==0){
        			printf("R%d is free!\n", p);
				}
			}
			printf("\nPress any key to go back to search menu");
			getch();
			goto S;
		}
		if(s_choice==4){
        	printf("\nFree rooms of B3 block are mention bellow!\n");
        	for(int p=1;p<=100; p++){
        		if(B2_room[p]==0){
        			printf("R%d is free!\n", p);
				}
			}
			printf("\nPress any key to go back to search menu");
			getch();
			goto S;
		}
		if(s_choice==5){
			goto A;
		}
    }
    
    if(choice==4){
    	bill:
    	printf("\nPress 1 for A2 block \nPress 2 for A3 block\nPress 3 for B2 block\nPress 4 for B3 block\n Press 5 for main menu\nEnter your choice: ");
        scanf("%d",&p_choice);
        if(p_choice==1){
        	printf("\nEnter room number:");
        	scanf("%d",&BR);
        	if(A2_room[BR]==0){
        		printf("\nRoom is free!\nPress any key to go back");
        		getch();
        		goto bill;
			}
			else{
				printf("\nID of student:%d",A2_ID[BR]);
				printf("\nBill of student:%d",A2_bill_final[BR]);
				printf("\nPress any key to go back");
        		getch();
        		goto bill;
				
			}
        	
		}
		if(p_choice==2){
			printf("\nEnter room number:");
        	scanf("%d",&BR);
        	if(A3_room[BR]==0){
        		printf("\nRoom is free!\nPress any key to go back");
        		getch();
        		goto bill;
			}
			else{
				printf("\nID of student:%d",A3_ID[BR]);
				printf("\nBill of student:%d",A3_bill_final[BR]);
				printf("\nPress any key to go back");
        		getch();
        		goto bill;
				
			}
		}
		
		if(p_choice==3){
			printf("\nEnter room number:");
        	scanf("%d",&BR);
        	if(B2_room[BR]==0){
        		printf("\nRoom is free!\nPress any key to go back");
        		getch();
        		goto bill;
			}
			else{
				printf("\nID of student:%d",B2_ID[BR]);
				printf("\nBill of student:%d",B2_bill_final[BR]);
				printf("\nPress any key to go back");
        		getch();
        		goto bill;
				
			}
		}
		if(p_choice==4){
			printf("\nEnter room number:");
        	scanf("%d",&BR);
        	if(B3_room[BR]==0){
        		printf("\nRoom is free!\nPress any key to go back");
        		getch();
        		goto bill;
			}
			else{
				printf("\nID of student:%d",B3_ID[BR]);
				printf("\nBill of student:%d",B3_bill_final[BR]);
				printf("\nPress any key to go back");
        		getch();
        		goto bill;
				
			}
		}
		if(p_choice==5){
			goto A;
		}
    }
    
    if(choice==5){
        printf("Bye Bye");
        getch();
        
    }
    return 0;
}

Fetching token
?