-
Notifications
You must be signed in to change notification settings - Fork 0
/
Santa.cpp
147 lines (135 loc) · 2.87 KB
/
Santa.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
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
#include<stdio.h>
#include<stdlib.h>
int b=0;
int c=0;
int x,y,z,q;
int menu(){
}
void helpelf(){
printf("Helping the succesful group of 3 elves!\n\n\n");
c=c-3;
printf("Ready your next queue of elves\n");
}
void prepsleigh(){
printf("Preparing Sleigh.........\n\n\n");
printf("Get ready to be hitched!\n");
}
void hitch(){
printf("Hitching the reindeers with the sleigh....\n\n\n");
printf("Hitching Successful!\n\n Over with the Reindeer's Task!\n");}
void santa(){
if(b==9){
printf("Wait reindeers let me prepare the sleigh\n");
b=0;
prepsleigh(); // prepares the sleigh as reindeers ask for same after their arrival
hitch(); //this makes the reindeer do hitch with the sleigh
printf("Did any elf enter the queue therewhile?\n press 1 for Yes\n press 2 for No\n");
scanf("%d", &z);
if(z==1){
printf("Enter the number of elves those entered the queue (max 3)\n");
scanf("%d", &q);
c=c+q;}
else {
printf("Okay moving forward\n");
}
}
if(c>=3)
{
helpelf();
if(c!=0){
printf("Others wait in next queue");
}
}
else{
printf("Let me know elves, what's the matter? (ELF)\n");
helpelf();
}
}
void elf(){
c++;
printf("Entry for an elf acknowledged!\n");
printf("Total elf in queue is : %d\n", c);
if(c==3){
santa();
}
else{
printf("Wait, while your queue hits with a number 3, elves!\n");
printf("Wish to renter the menu? If yes, press 1.\n Else, press 2 for EXIT\n");
scanf("%d",&y);
switch(y){
case 1:
int p;
printf("Enter your entry for respective registration: \n");
printf("1.Entry as a Reindeer\n");
printf("2.Entry as an Elve\n");
printf("press any other, to exit\n");
scanf("%d", &p);
switch (p) {
case 1:
b++;
printf("entry ack. for reindeer!\n");
break;
case 2:
elf();
break;
default:
exit(0);}
break;
case 2:
printf("dropping off to the end\n");
default:
exit(0);
}
}}
void reind(){
b++;
printf("Entry for Reindeer acknowledged!\n");
printf("Total reindeer in queue is: %d\n", b);
if(b==9){
santa();
}
else{
printf("Wait, while your queue hits with a number 9, reindeers!\n");
printf("Wish to renter the menu? If yes, press 1.\n Else, press 2 for EXIT\n");
scanf("%d",&x);
switch(x){
case 1:
int p;
printf("Enter your entry for respective registration: \n");
printf("1.Entry as a Reindeer\n");
printf("2.Entry as an Elve\n");
printf("press any other, to exit\n");
scanf("%d", &p);
switch (p) {
case 1:
reind();
break;
case 2:
elf();
break;
default:
exit(0);}
break;
case 2:
printf("dropping off to the end\n");
default:
exit(0);
}
}
}
int main(){
int a;
printf("Enter your entry for respective registration: \n");
printf("1.Entry as a Reindeer\n");
printf("2.Entry as an Elve\n");
scanf("%d", &a);
switch (a) {
case 1:
reind();
break;
case 2:
elf();
break;
default:
exit(0);
}}