-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
63 lines (59 loc) · 1.58 KB
/
main.c
File metadata and controls
63 lines (59 loc) · 1.58 KB
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
#include <stdio.h>
#include <string.h>
#include "manager.h"
//#define DEBUG
int main(){
Product plist[10000];
int count = 0, index = 0, menu;
count = loadData(plist);
index = count;
#ifdef DEBUG
printf("Debug: %s %s %s %d\n", __DATE__, __TIME__, __FILE__, __LINE__);
#endif
while(1){
menu = selectMenu();
if(menu == 0) break;
if(menu == 1 || menu ==3 || menu == 4)
if(count == 0) continue;
if(menu == 1) {
if (count > 0) listProduct(plist, index);
}
else if(menu == 2) {
count += createProduct(&plist[index++]);
}
else if(menu == 3) {
int no = selectDataNo(plist, index);
if(no == 0){
printf("=> 취소됨!\n");
continue;
}
updateProduct(&plist[no-1]);
}
else if(menu == 4){
int no = selectDataNo(plist, index);
if(no > 0){
int deleteok;
printf("정말로 삭제하시겠습니까?(삭제:1)");
scanf("%d", &deleteok);
if(deleteok == 1){
deleteProduct(&plist[no-1]);
count--;
}
}
}
else if(menu == 5){
saveData(plist, index);
}
else if(menu == 6){
searchName(plist,index);
}
else if(menu == 7){
searchPrice(plist, index);
}
else if(menu == 8){
searchGrade(plist, index);
}
}
printf("종료됨!\n");
return 0;
}