본문내용
rintf("***** 물품 관리 프로그램 *****\n\n");
printf("================================\n");
printf(">>> 물품 등록화면\n\n");
printf("1. 제품명을 입력하시오.=>");
gets(name);
fflush(stdin);
printf("2. 제조사을 입력하시오.=>");
gets(company);
fflush(stdin);
printf("3. 제조년도를 입력하시오.=>");
scanf("%d", &year);
fflush(stdin);
printf("4. 가격을 입력하시오.=>");
scanf("%d", &cost);
fflush(stdin);
fprintf(f, "%s\t", name);
fprintf(f, "%s\t", company);
fprintf(f, "%d\t", year);
fprintf(f, "%d\n", cost);
fclose(f);
printf("\n아무키나 누르세요");
wait=getchar();
fflush(stdin);
}
void load_product()
{
sn=0;
sne=0;
FILE *f;
f=fopen("product.txt", "r");
if(f==NULL)
return;
else
{
while(feof(f)==0)
{
fscanf(f,"%s", p[sn].name);
fscanf(f,"%s", p[sn].company);
fscanf(f,"%d", &p[sn].year);
fscanf(f,"%d", &p[sn].cost);
sn++;
sne++;
}
fclose(f);
}
}
*실행 결과*
printf("================================\n");
printf(">>> 물품 등록화면\n\n");
printf("1. 제품명을 입력하시오.=>");
gets(name);
fflush(stdin);
printf("2. 제조사을 입력하시오.=>");
gets(company);
fflush(stdin);
printf("3. 제조년도를 입력하시오.=>");
scanf("%d", &year);
fflush(stdin);
printf("4. 가격을 입력하시오.=>");
scanf("%d", &cost);
fflush(stdin);
fprintf(f, "%s\t", name);
fprintf(f, "%s\t", company);
fprintf(f, "%d\t", year);
fprintf(f, "%d\n", cost);
fclose(f);
printf("\n아무키나 누르세요");
wait=getchar();
fflush(stdin);
}
void load_product()
{
sn=0;
sne=0;
FILE *f;
f=fopen("product.txt", "r");
if(f==NULL)
return;
else
{
while(feof(f)==0)
{
fscanf(f,"%s", p[sn].name);
fscanf(f,"%s", p[sn].company);
fscanf(f,"%d", &p[sn].year);
fscanf(f,"%d", &p[sn].cost);
sn++;
sne++;
}
fclose(f);
}
}
*실행 결과*
추천자료
트리(tree)관련 프로그래밍 소스 모음 (C언어)
함수형 프로그래밍
가위바위보 C프로그래밍 프로젝트(단순 가위바위보프로그래밍이 아닌, 랭킹&사용자등록&a...
C로 배우는 프로그래밍 기초 - 컴퓨터와 프로그램
[c 프로그램 레포트] 자동 업데이트 프로그램 c프로그래밍
[JAVA언어] sic/xe 머신 시뮬레이터, 시스템 프로그래밍 과제
교수방법의 유형 고찰과 LOGO프로그래밍(로고프로그래밍)의 개념, LOGO프로그래밍(로고프로그...
커널 프로그래밍 기초
쉽게 풀어 쓴 C언어 익스프레스 프로그래밍 문제 3장,4장(홀수)
컴퓨터프로그래밍(경마게임)
c언어를 이용한 컴퓨터프로그래밍
[객체지향프로그래밍][객체지향]객체지향프로그래밍의 개요, 객체지향프로그래밍의 정의, 객...
프로그래밍 기초 - 변환명세 및 연산 이해
<<열혈강의 C 도전 프로그래밍 ONE 1장 솔루션>>열혈강의 C,도전 프로그래밍,문제풀이,솔루션...
소개글