-
Notifications
You must be signed in to change notification settings - Fork 8
/
Ccafe_question.c
58 lines (44 loc) · 1.12 KB
/
Ccafe_question.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
#include <stdio.h>
#include <stdbool.h>
#define init_cake_num 40
// Write your code here
/* global variable declaration */
// Write your code here
void menu(int cake, int cookie, int coffee) {
printf("What do you want to order?\n");
printf("1) cake : %d\n", cake);
printf("2) cookie : %d\n", cookie);
printf("3) coffee : %d\n", coffee);
}
void buy() {
scanf("%d", &choice);
/* local variable declaration */
int pic = 0;
/* static variable declaration */
// Write your code here
switch (choice) {
case 1:
// Write your code here
case 2:
// Write your code here
case 3:
// Write your code here
case 5:
printf("Do you want a picture?\n1) yes\n0) no\n");
int a;
scanf("%d", &a);
if (a)
pic++;
break;
default:
// Write your code here
}
printf("pic num = %d\n", pic);
}
int main() {
menu(init_cake_num, init_cookie_num, init_coffee_num);
while(choice != 5)
buy();
printf("C U soon\n");
return 0;
}