-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jang soyeon
committed
Apr 22, 2020
1 parent
a483360
commit 74e9807
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "manager.h" | ||
|
||
int selectMenu(){ | ||
int menu; | ||
printf("\n*** 제품 관리 ***\n"); | ||
printf("1. 조회\n"); | ||
printf("2. 추가\n"); | ||
printf("3. 수정\n"); | ||
printf("4. 삭제\n"); | ||
printf("5. 저장\n"); | ||
printf("0. 종료\n\n"); | ||
printf("=> 원하는 메뉴는? "); | ||
scanf("%d", &menu); | ||
return menu; | ||
} | ||
void listProduct(Product *p,int count){ | ||
|
||
printf("\nNo. Name weight price\n"); | ||
printf("================================\n"); | ||
for(int i=0; i<count; i++){ | ||
if( p[i].weight == -1 || p[i].price == -1 ) continue; | ||
printf("%2d.", i+1); | ||
readProduct(&p[i]); | ||
} | ||
printf("\n"); | ||
} | ||
|
||
int selectDataNo(Product *p, int count){ | ||
int no; | ||
listProduct(p,count); | ||
printf("번호는 (취소:0)?"); | ||
scanf("%d",&no); | ||
getchar(); | ||
return no; | ||
} | ||
|
||
//배열데이터를 파일에 저장하는 함수 | ||
void saveData(Product p[], int count){ | ||
FILE* fp; | ||
|
||
//중량 가격 제품명 | ||
fp= fopen("product.txt","wt"); | ||
|
||
|
||
fclose(fp); | ||
printf("저장됨!\n"); | ||
} | ||
|
||
|
||
//파일에서 데이터 불러오는 함수 | ||
int loadData(Product *p){ | ||
int count=0; | ||
FILE*fp; | ||
|
||
//파일 내용을 읽어와서 배열에 값 추가하기 | ||
|
||
|
||
|
||
|
||
printf("=> 로딩 성공!\n"); | ||
return count; | ||
} |