-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
65 lines (60 loc) · 1.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
#include "book.h"
int main(void){
Book slist[100];
int curcount = 0;
int count = 0, menu;
//count = loadData(slist);
curcount = count;
while (1){
menu = selectMenu();
if (menu == 0) break;
if (menu == 1){
if(count > 0){
listBook(slist,curcount);
}else{
printf("데이터가 없습니다! \n");
}
}
else if (menu == 2){
count += newBook(&slist[curcount]);
curcount ++;
}
else if (menu == 3){
int no = selectDataNo(slist,curcount);
if(no == 0){
printf("=> 취소됨 ! \n");
continue;
}
updateBook(&slist[no-1]);
}
else if (menu == 4){
int no = selectDataNo(slist,curcount);
if(no == 0){
printf("=> 취소됨 ! \n");
continue;
}
int deleteok;
printf("정말로 삭제하시겠습니까? (삭제 : 1)");
scanf("%d", &deleteok);
if(deleteok == 1){
if(deleteBook(&slist[no-1])){
count--;
}
}
}
else if (menu == 5){
if(count == 0)
printf("=> 데이터 없음!\n");
else
saveData(slist, curcount);
}
else if (menu == 6){
if(count == 0)
printf("=> 데이터 없음!\n");
else
searchName(slist, curcount);
}
}
printf("종료됨!\n");
return 0;
}