-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
191 lines (163 loc) · 3.62 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
181
182
183
184
185
186
187
188
189
190
//
// main.c
// Billing System
//
// Created by rajlaxmi meshram on 29/09/22.
//
#include <stdio.h>
int choise=0,b=1,q,s,d,t,c,i,s1,d1,t1,c1,i1,tBill=0;
void menu()
{
printf("::Menu::\n");
printf("1.Samosa 20/-\n");
printf("2.Dosa 35/-\n");
printf("3.tea 10/-\n");
printf("4.coffee 50/-\n");
printf("5.ice creem 30/-\n");
printf("0.exit\n");
}
void quantity(int choise)
{
switch(choise)
{
case 1:
case 2:
printf("plate =");
break;
case 3:
case 4:
printf("cups =");
break;
}
}
void billing(int cBill)
{
tBill+=cBill;
}
void printBill()
{
printf("G Total = %d\n",tBill);
}
void order()
{
while(b)
{
menu();
printf("enter choise:");
scanf("%d",&choise);
switch(choise)
{
case 1:
printf("you have order samosa\n");
printf("how many ");
quantity(choise);
scanf("%d",&s);
s1+=s;
printf("ok anything else........\n");
billing(s*20);
break;
case 2:
printf("you have order dosa\n");
printf("how many ");
quantity(choise);
scanf("%d",&d);
d1+=d;
printf("ok anything else.......\n");
billing(d*35);
break;
case 3:
printf("you have order tea\n");
printf("how many ");
quantity(choise);
scanf("%d",&t);
t1+=t;
printf("ok anything else......\n");
billing(t*10);
break;
case 4:
printf("you have order coffee\n");
printf("how many ");
quantity(choise);
scanf("%d",&c);
c1+=c;
printf("ok anything else.....\n");
billing(c*50);
break;
case 5:
printf("you have order ice cream\n");
printf("how many =");
scanf("%d",&i);
quantity(choise);
i1+=i;
printf("ok anything else......\n");
billing(i*30);
break;
case 0:
printf("exit\n");
b=0;
break;
}
}
}
void table()
{
if (s1)
{
printf(" samosa | %d | 20 | %d\n",s1,s1*20);
}
if (d1)
{
printf(" dosa | %d | 35 | %d\n",d1,d1*35);
}
if (t1)
{
printf(" tea | %d | 10 | %d\n",t1,t1*10);
}
if (c1)
{
printf(" coffee | %d | 50 | %d\n",c1,c1*50);
}
if (i1)
{
printf(" ice cream | %d | 30 | %d\n",i1,i1*20);
}
}
void money()
{
int cash,rCash;
printf("enter your cash : ");
scanf("%d",&cash);
rCash=cash-tBill;
printf("return cash = %d\n\n",rCash);
int note;
for(int i = 100; i != 0; i = i/2)
{
note = rCash / i;
if(note==0)
{
printf("");
}
else
{
printf("There are %d Note(s) of %d\n",note,i);
}
rCash = rCash % i;
if ( i == 50)
{
i = 40;
}
}
}
int main()
{
printf("::welcome to cosmer::\n");
order();
printf(" Item | Qty | Rate | Total\n");
printf("---------------------------------------------------\n");
table();
printf("---------------------------------------------------\n");
printBill();
printf("---------------------------------------------------\n");
money();
return 0;
}