-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct.c
More file actions
42 lines (32 loc) · 818 Bytes
/
product.c
File metadata and controls
42 lines (32 loc) · 818 Bytes
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
#include "product.h"
int createProduct(Product *p){
printf("\n");
printf("제품명은? ");
scanf("%[^\n]s",p->name);
printf("중량은? ");
scanf("%d",&p->weight);
printf("가격은? ");
scanf("%d",&p->price);
printf("==> 추가됨\n");
return 1;
}
void readProduct(Product *p){
printf("%-15s %3dg %4d원\n",p->name,p->weight,p->price);
}
int updateProduct(Product *p){
printf("\n");
printf("제품명은? ");
scanf("%[^\n]s",p->name);
printf("중량은? ");
scanf("%d",&p->weight);
printf("가격은? ");
scanf("%d",&p->price);
printf("==> 수정됨!\n");
return 1;
};
int deleteProduct(Product *p){
p->weight=-1;
p->price=-1;
printf("==> 삭제됨!\n");
return 0;
}