수다닷컴

  • 해외여행
    • 괌
    • 태국
    • 유럽
    • 일본
    • 필리핀
    • 미국
    • 중국
    • 기타여행
    • 싱가폴
  • 건강
    • 다이어트
    • 당뇨
    • 헬스
    • 건강음식
    • 건강기타
  • 컴퓨터
    • 프로그램 개발일반
    • C언어
    • 비주얼베이직
  • 결혼생활
    • 출산/육아
    • 결혼준비
    • 엄마이야기방
  • 일상생활
    • 면접
    • 취업
    • 진로선택
  • 교육
    • 교육일반
    • 아이교육
    • 토익
    • 해외연수
    • 영어
  • 취미생활
    • 음악
    • 자전거
    • 수영
    • 바이크
    • 축구
  • 기타
    • 강아지
    • 제주도여행
    • 국내여행
    • 기타일상
    • 애플
    • 휴대폰관련
  • 프로그램 개발일반
  • C언어
  • 비주얼베이직

주석좀달아주세요ㅜ.ㅜ

말근

2023.04.01


질문 제목 : 자판기소스입니다 주석좀달아주시면감사하겟습니다ㅜㅜ저는도저히이해가안되서요질문 내용 : #include stdio.h
#include stdlib.h
#include string.h
#include time.h
#include windows.h
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct daysell // 구조체 선언
{
int year; //년도
int mon; //월
int day; //일
}day;
typedef struct data{
char name[20];
int price;
int count;
struct data* next;
}data;
data* head;
data* tail;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void init();
void data_menu(); //메뉴선택화면
void data_select1(); //물품구매모드
void choice_food();//음식선택
void choice_cookie(); //과자선택
void choice_drink(); //음료선택
void choice_ice(); //빙과류선택
void choice_alcohol(); //주류선택
void sell_list(); //구매물품목록 읽기
void sell(); //계산
void day_sell(); //일일정산함수
void daysell_load(); //일일정산불러오기
void daysell_print(int); //일일정산출력
void data_select2(); //관리자모드
void data_delete(); //물품삭제
void data_search(); //데이터 검색
void insert_select(); //품목별 품목추가
void save();
void food_save();//음식저장
void cookie_save(); //과자저장
void drink_save(); //음료저장
void ice_save(); //빙과류저장
void alcohol_save(); //주류저장
void load_select(); //품목별 물품조회
void food_load();

void cookie_load(); //과자 조회
void drink_load(); //음료 조회
void ice_load(); //빙과류 조회
void alcohol_load(); //주류 조회
void delete_select(); //품목별 물품삭제
void food_del();
void cookie_del(); //과자 삭제
void drink_del(); //음료 삭제
void ice_del(); //빙과류 삭제
void alcohol_del(); //주류 삭제
void node_deleteall();
void data_print(); //물품출력
void node_print(data* p);
void head_print();
void tail_print();
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main(){
init();
data_menu();
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void init(){
head = (data*)malloc(sizeof(data));
tail = (data*)malloc(sizeof(data));
head-next = tail;
tail-next = tail;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void data_menu(){
int choice;
do{
printf(\t\t\t********menu********\n);
printf(\t\t\t1. (자판기판매시작) \n);
printf(\t\t\t2. (자판기관리모드) \n);
printf(\t\t\t0. (자판기 종료) \n);
printf(\t\t\t********************\n\n\n);
printf(\t\t\t choice (선택) [ ]\b\b\b);
scanf(%d,&choice);
switch(choice){
case 1: system(cls); data_select1(); break;
case 2: system(cls); data_select2(); break;
case 0: system(cls); printf(\n\n\n\n\t\t\t*자판기전원을 종료합니다*\n\n\n\n\n\n\n\n);
&n
}

}while(choice != 0);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void data_select1()
{
int choice;
do
{
//printf(\t\t\t********menu********\n);
printf(\t\t\t***** 구매할목록 *****\n\n);
printf(\t\t\t 1. 음식구매 \n);
printf(\t\t\t 2. 과자구매 \n);
printf(\t\t\t 3. 음료구매 \n);
printf(\t\t\t 4. 빙과구매 \n);
printf(\t\t\t 5. 주류구매 \n);
printf(\t\t\t 6. 총 계산 \n);
printf(\t\t\t 0. 메 인 \n\n);
printf(\t\t\t***********************\n\n\n);
printf(\t\t\t choice (선택) [ ]\b\b\b);
scanf(%d,&choice);
switch(choice){
case 1: system(cls); choice_food(); break;
case 2: system(cls); choice_cookie(); break;
case 3: system(cls); choice_drink(); break;
case 4: system(cls); choice_ice(); break;
case 5: system(cls); choice_alcohol(); break;
case 6: system(cls); sell(); break;
case 0: system(cls); break;
}
}while(choice != 0);

}
/////////////////////////////////////////////////////////////////////////////////////////////
void choice_food()
{
food_load(); data_print();
data* p;
p = head-next;
char find_name[20];
file *file;
printf(선택할 물품 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0)
break;
else
p = p-next;
}
if(p == tail)
printf(입력한 물품 %s는 존재하지 않습니다.\n,find_name);
else{
printf(구매할 수량 : );
scanf(%d, &p-count);
printf(%5s ,p-name);
printf(&d원 ,p-price);
printf(%d개\n,p-count);

file=fopen(./sell.txt, a);
fprintf(file,%s %d %d\n,p-name, p-price, p-count);
fclose(file);
printf(선택한 물품을 구매목록에 담았습니다.\n);
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void choice_cookie()
{
cookie_load(); data_print();
data* p;
p = head-next;
char find_name[20];
file *file;
printf(\t\t\t선택할 물품 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0)
break;
else
p = p-next;
}
if(p == tail)
printf(입력한 물품 %s는 존재하지 않습니다.\n,find_name);
else{
printf(구매할 수량 : );
scanf(%d, &p-count);
printf(%5s ,p-name);
printf(&d원 ,p-price);
printf(%d개\n,p-count);

file=fopen(./sell.txt, a);
fprintf(file,%s %d %d\n,p-name, p-price, p-count);
fclose(file);
printf(선택한 물품을 구매목록에 담았습니다.\n);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void choice_drink()
{
drink_load(); data_print();
data* p;
p = head-next;
char find_name[20];
file *file;
printf(선택할 물품 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0)
break;
else
p = p-next;
}
if(p == tail)
printf(입력한 물품 %s는 존재하지 않습니다.\n,find_name);
else{
printf(구매할 수량 : );
scanf(%d, &p-count);
printf(%5s ,p-name);
printf(%d원 ,p-price);
printf(%d개\t,p-count);
file=fopen(./sell.txt, a);
fprintf(file,%s %d %d\n,p-name, p-price, p-count);
fclose(file);
printf(선택한 물품을 구매목록에 담았습니다.\n);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void choice_ice()
{
ice_load(); data_print();
data* p;
p = head-next;
char find_name[20];
file *file;
printf(선택할 물품 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0)
break;
else
p = p-next;
}
if(p == tail)
printf(입력한 물품 %s는 존재하지 않습니다.\n,find_name);
else{
printf(구매할 수량 : );
scanf(%d, &p-count);
printf(%5s ,p-name);
printf(%d원 ,p-price);
printf(%d개\t,p-count);
file=fopen(./sell.txt, a);
fprintf(file,%s %d %d\n,p-name, p-price, p-count);
fclose(file);
printf(선택한 물품을 구매목록에 담았습니다.\n);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void choice_alcohol()
{
alcohol_load(); data_print();
data* p;
p = head-next;
char find_name[20];
file *file;
printf(선택할 물품 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0)
break;
else
p = p-next;
}
if(p == tail)
printf(입력한 물품 %s는 존재하지 않습니다.\n,find_name);
else{
printf(구매할 수량 : );
scanf(%d, &p-count);
printf(%5s ,p-name);
printf(%d원 ,p-price);
printf(%d개\t,p-count);
file=fopen(./sell.txt, a);
fprintf(file,%s %d %d\n,p-name, p-price, p-count);
fclose(file);
printf(선택한 물품을 구매목록에 담았습니다.\n);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void sell_list() //구매선택한 물품
{
file *file;
data *p;
file=fopen(./sell.txt,r);
if(file == null){
printf(물품이 없습니다.\n);
return;
}

else
{
printf(== 구매선택한 물품 ==\n);
p = (data*)malloc(sizeof(data));
node_deleteall();
while((fscanf(file,%s%d%d, p-name, &p-price, &p-count)) != -1){
p-next = head-next;
head-next = p;
p = (data*)malloc(sizeof(data));
}

data_print();
}

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void sell()
{
int sum=0, money=0;
int choice, price, count;
file *file;
data *p;
file=fopen(./sell.txt,r);
if(file == null){
printf(물품이 없습니다.\n);
return;
}

else
{
printf(== 구매선택한 물품 ==\n);
p = (data*)malloc(sizeof(data));
node_deleteall();
while((fscanf(file,%s%d%d, p-name, &p-price, &p-count)) != -1){
p-next = head-next;
head-next = p;
sum+=(p-price * p-count);
p = (data*)malloc(sizeof(data));
}

data_print();
}
fclose(file);
printf(총 계산 금액 : %d\n, sum);

while (1)
{
printf(계산 금액을 지불하시오 : );
scanf(%d, &money);
if (moneysum)
printf(금액이 부족합니다. 다시 입력하시오.\n);
else if (money==sum)
{
printf(계산되었습니다. 감사합니다\n);
day_sell();
break;
}
else
{
printf(계산되었습니다. 감사합니다.\n);
printf(거스름돈 : %d\n, money-sum);
day_sell();
break;
}
}
file=fopen(./sell.txt,w);
fclose(file);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void day_sell()
{
day date;
///////////////////////////////
time_t times;
struct tm *ti;
time(×);
ti=localtime(×);
///////////////////////////////
date.year = ti-tm_year+1900;
date.mon = ti-tm_mon+1;
date.day = ti-tm_mday;
file *file, *file_daysell;
data *p;
int sum=0;
file=fopen(./sell.txt,r);
if(file == null)
return;
else
{
p = (data*)malloc(sizeof(data));
node_deleteall();
while((fscanf(file,%s%d%d, p-name, &p-price, &p-count)) != -1){
p-next = head-next;
head-next = p;
sum=(p-price * p-count);
file_daysell=fopen(./day_sell.txt, a);
fprintf(file_daysell, %d %d %d , date.year,date.mon, date.day);
fprintf(file_daysell,%s %d %d %d\n,p-name, p-price, p-count, sum);
p = (data*)malloc(sizeof(data));
}
}
fclose(file);
fclose(file_daysell);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void data_select2(){
int choice;
do{
printf(\t\t\t***** 관리자모드 *****\n\n);
printf(\t\t\t 1. 물품추가 \n);
printf(\t\t\t 2. 물품조회 \n);
printf(\t\t\t 3. 물품삭제 \n);
printf(\t\t\t 4. 일일정산 \n);
printf(\t\t\t 0. 메 인 \n\n);
printf(\t\t\t***********************\n\n\n);
printf(\t\t\t choice (선택) [ ]\b\b\b);
scanf(%d,&choice);

switch(choice){
case 1: insert_select(); break;
case 2: load_select(); break;
case 3: delete_select(); break;
case 4: daysell_load(); break;
case 0: system(cls); break;
}
}while(choice != 0);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void insert_select(){
system(cls);
int choice;
do{
printf(\t\t\t***** 물품추가 *****\n\n);
printf(\t\t\t 1. 음식추가 \n);
printf(\t\t\t 2. 과자추가 \n);
printf(\t\t\t 3. 음료추가 \n);
printf(\t\t\t 4. 빙과추가 \n);
printf(\t\t\t 5. 주류추가 \n);
printf(\t\t\t 0. 상위메뉴 \n);
printf(\t\t\t***********************\n\n\n);
printf(\t\t\t choice (선택) [ ]\b\b\b);
scanf(%d,&choice);

switch(choice){
case 1: init(); save(); food_save(); system(cls); break;
case 2: init(); save(); cookie_save(); system(cls); break;
case 3: init(); save(); drink_save(); system(cls); break;
case 4: init(); save(); ice_save(); system(cls); break;
case 5: init(); save(); alcohol_save(); system(cls); break;
case 0: system(cls); break;
}
}while(choice != 0);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void save(){
data* p;
data* q;
q = head-next;
p = (data*)malloc(sizeof(data));
printf(물품명 : );
scanf(%s,p-name);
printf(가격 : );
scanf(%d,&p-price);
printf(수량 : );
scanf(%d,&p-count);
p-next = head-next;
head-next = p;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void food_save() {
file* file;
data* p;
p = head-next;
file = fopen(food.txt, a);

while(p != tail){
fprintf(file,%s ,p-name);
fprintf(file,%d ,p-price);
fprintf(file,%d ,p-count);
p = p-next;
}
fclose(file);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void cookie_save() {
file* file;
data* p;
p = head-next;
file = fopen(cookie.txt, a);

while(p != tail){
fprintf(file,%s ,p-name);
fprintf(file,%d ,p-price);
fprintf(file,%d ,p-count);
p = p-next;
}
fclose(file);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void drink_save() {
file* file;
data* p;
p = head-next;
file = fopen(drink.txt, a);

while(p != tail){
fprintf(file,%s ,p-name);
fprintf(file,%d ,p-price);
fprintf(file,%d ,p-count);
p = p-next;
}
fclose(file);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ice_save() {
file* file;
data* p;
p = head-next;
file = fopen(ice.txt, a);

while(p != tail){
fprintf(file,%s ,p-name);
fprintf(file,%d ,p-price);
fprintf(file,%d ,p-count);
p = p-next;
}
fclose(file);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void alcohol_save() {
file* file;
data* p;
p = head-next;
file = fopen(alcohol.txt, a);

while(p != tail){
fprintf(file,%s ,p-name);
fprintf(file,%d ,p-price);
fprintf(file,%d ,p-count);
p = p-next;
}
fclose(file);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void load_select(){
system(cls);
int choice;
do{
printf(\t\t\t***** 물품조회 *****\n\n);
printf(\t\t\t 1. 음식조회 \n);
printf(\t\t\t 2. 과자조회 \n);
printf(\t\t\t 3. 음료조회 \n);
printf(\t\t\t 4. 빙과조회 \n);
printf(\t\t\t 5. 주류조회 \n);
printf(\t\t\t 6. 전체조회 \n);
printf(\t\t\t 0. 상위메뉴 \n\n);
printf(\t\t\t***********************\n\n\n);
printf(\t\t\t choice (선택) [ ]\b\b\b);
scanf(%d,&choice);

switch(choice){
case 1: system(cls); printf(음식\n); food_load(); data_print(); break;
case 2: system(cls); printf(과자\n); cookie_load(); data_print(); break;
case 3: system(cls); printf(음료\n); drink_load(); data_print();break;
case 4: system(cls); printf(빙과\n); ice_load(); data_print();break;
case 5: system(cls); printf(주류\n); alcohol_load(); data_print();break;
case 6: system(cls); printf(과자\n); cookie_load(); data_print();
printf(음료\n); drink_load(); data_print();
printf(빙과\n); ice_load(); data_print();
printf(주류\n); alcohol_load(); data_print();break;
case 0: system(cls); break;
}
}while(choice != 0);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void food_load(){
file* file;
data* p;
file = fopen(./food.txt,r);
if(file == null){
printf(물품이 없습니다.\n);
return;
}

p = (data*)malloc(sizeof(data));
node_deleteall();
while((fscanf(file,%s%d%d, p-name, &p-price, &p-count)) != -1){
p-next = head-next;
head-next = p;
p = (data*)malloc(sizeof(data));
}
fclose(file);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void cookie_load(){
file* file;
data* p;
file = fopen(./cookie.txt,r);
if(file == null){
printf(물품이 없습니다.\n);
return;
}

p = (data*)malloc(sizeof(data));
node_deleteall();
while((fscanf(file,%s%d%d, p-name, &p-price, &p-count)) != -1){
p-next = head-next;
head-next = p;
p = (data*)malloc(sizeof(data));
}
fclose(file);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void drink_load(){
file* file;
data* p;
file = fopen(./drink.txt,r);
if(file == null){
printf(물품이 없습니다.\n);
return;
}

p = (data*)malloc(sizeof(data));
node_deleteall();
while((fscanf(file,%s%d%d, p-name, &p-price, &p-count)) != -1){
p-next = head-next;
head-next = p;
p = (data*)malloc(sizeof(data));
}
fclose(file);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ice_load(){
file* file;
data* p;
file = fopen(./ice.txt,r);
if(file == null){
printf(물품이 없습니다.\n);
return;
}

p = (data*)malloc(sizeof(data));
node_deleteall();
while((fscanf(file,%s%d%d, p-name, &p-price, &p-count)) != -1){
p-next = head-next;
head-next = p;
p = (data*)malloc(sizeof(data));
}

fclose(file);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void alcohol_load(){
file* file;
data* p;
file = fopen(./alcohol.txt,r);
if(file == null){
printf(물품이 없습니다.\n);
return;
}

p = (data*)malloc(sizeof(data));
node_deleteall();
while((fscanf(file,%s%d%d, p-name, &p-price, &p-count)) != -1){
p-next = head-next;
head-next = p;
p = (data*)malloc(sizeof(data));
}
fclose(file);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void node_deleteall(){
data* p;
data* q ;
q = head;
p = q-next;
while(p != tail){
q-next = p-next;
free(p);
p = q-next;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void data_print(){
data* p;
p = head-next;
if(p == tail){
printf(물품이 없습니다.\n);
return;
}
head_print();
while(p != tail){
node_print(p);
p = p-next;
}
tail_print();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void node_print(data* p){
printf(%10s\t,p-name);
printf(%d\t,p-price);
printf(%d\n,p-count);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void delete_select(){
system(cls);
int choice;
do{

printf(\t\t\t***** 물품삭제 *****\n\n);
printf(\t\t\t 1. 음식삭제 \n);
printf(\t\t\t 2. 과자삭제 \n);
printf(\t\t\t 3. 음료삭제 \n);
printf(\t\t\t 4. 빙과삭제 \n);
printf(\t\t\t 5. 주류삭제 \n);
printf(\t\t\t 0. 상위메뉴 \n);
printf(\t\t\t***********************\n\n\n);
printf(\t\t\t choice (선택) [ ]\b\b\b);
scanf(%d,&choice);
switch(choice){
case 1: system(cls); food_load(); data_prinata_print(); food_del(); break;
case 2: system(cls); cookie_load(); data_print(); cookie_del(); break;
case 3: system(cls); drink_load(); data_print(); drink_del(); break;
case 4: system(cls); ice_load(); data_print(); ice_del(); break;
case 5: system(cls); alcohol_load(); data_print(); alcohol_del(); break;
case 0: system(cls); break;
}
}while(choice != 0);

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void food_del(){
food_load();
data* p; //삭제할 노드
data* q;//삭제하기위한 앞노드
char find_name[20];

q = head;
p = q-next;
printf(삭제할 이름 입력 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0){
break;
}else{
q = q-next;
p = q-next;
}
}
if(p == tail){
printf(입력한 이름 \ %s \는 존재하지 않습니다.\n,find_name);
}else{
q-next = p-next;
free(p);
printf(입력한 이름 \ %s \를 삭제 했습니다.\n,find_name);
}
file *file;
file=fopen(cookie.txt, w);
fclose(file);
food_save();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void cookie_del(){
cookie_load();
data* p; //삭제할 노드
data* q;//삭제하기위한 앞노드
char find_name[20];

q = head;
p = q-next;
printf(삭제할 이름 입력 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0){
break;
}else{
q = q-next;
p = q-next;
}
}
if(p == tail){
printf(입력한 이름 \ %s \는 존재하지 않습니다.\n,find_name);
}else{
q-next = p-next;
free(p);
printf(입력한 이름 \ %s \를 삭제 했습니다.\n,find_name);
}
file *file;
file=fopen(cookie.txt, w);
fclose(file);
cookie_save();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void drink_del(){
drink_load();
data* p; //삭제할 노드
data* q;//삭제하기위한 앞노드
char find_name[20];

q = head;
p = q-next;
printf(삭제할 이름 입력 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0){
break;
}else{
q = q-next;
p = q-next;
}
}
if(p == tail){
printf(입력한 이름 \ %s \는 존재하지 않습니다.\n,find_name);
}else{
q-next = p-next;
free(p);
printf(입력한 이름 \ %s \를 삭제 했습니다.\n,find_name);
}
file *file;
file=fopen(drink.txt, w);
fclose(file);
drink_save();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ice_del(){
ice_load();
data* p; //삭제할 노드
data* q;//삭제하기위한 앞노드
char find_name[20];

q = head;
p = q-next;
printf(삭제할 이름 입력 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0){
break;
}else{
q = q-next;
p = q-next;
}
}
if(p == tail){
printf(입력한 이름 \ %s \는 존재하지 않습니다.\n,find_name);
}else{
q-next = p-next;
free(p);
printf(입력한 이름 \ %s \를 삭제 했습니다.\n,find_name);
}
file *file;
file=fopen(ice.txt, w);
fclose(file);
ice_save();
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void alcohol_del(){
alcohol_load();
data* p; //삭제할 노드
data* q;//삭제하기위한 앞노드
char find_name[20];

q = head;
p = q-next;
printf(삭제할 이름 입력 : );
scanf(%s,find_name);
while(p != tail){
if(strcmp(find_name, p-name) == 0){
break;
}else{
q = q-next;
p = q-next;
}
}
if(p == tail){
printf(입력한 이름 \ %s \는 존재하지 않습니다.\n,find_name);
}else{
q-next = p-next;
free(p);
printf(입력한 이름 \ %s \를 삭제 했습니다.\n,find_name);
}
file *file;
file=fopen(alcohol.txt, w);
fclose(file);
alcohol_save();
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void head_print(){
printf(==================================\n);
printf( 이름\t가격\t수량\n);
printf(==================================\n);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void tail_print(){
printf(==================================\n\n);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void daysell_load()
{
int sum=0;
file* file;
data* p;
day date;
data data;
time_t times;
struct tm *ti;
time(×);
ti=localtime(×);
date.year = ti-tm_year+1900;
date.mon = ti-tm_mon+1;
date.day = ti-tm_mday;

file = fopen(./day_sell.txt,r);
system(cls);

printf(========================================\n);
printf( 날짜\t이름\t가격\t판매수량\n);
printf(========================================\n);
if(file == null ||sizeof(file)1)
{
printf(물품이 없습니다.\n\n\n\n);
return;
}
else
while((fscanf(file,%d%d%d%s%d%d, &date.year, &date.mon, &date.day, data.name, &data.price, &data.count)) != -1)
{
sum+=(data.price * data.count);
printf(%10d %8s %6d %10d \n\n, date.year, data.name, data.price, data.count );
}
printf(총계 : %d\n,sum);

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

신청하기





COMMENT

댓글을 입력해주세요. 비속어와 욕설은 삼가해주세요.

  • 인1형녀

    그플로우챠트를못그리겟어서..

  • 유진깡

    실례가안된다면 이소스흐름을좀알려주세ㅕㅜㅜ

  • 더글러스

    주석 달려있네요...저정도면 소스분석하시는데 지장없으실듯하네요.
    일단 프로그램의 플로우챠트를 그려보세요.

번호 제 목 글쓴이 날짜
2700426 인터넷 창 띄우는 질문이요 (1) 정훈 2025-07-04
2700400 원넓이를 계산이요 ㅜㅜ 천칭자리 2025-07-04
2700368 if에 관해서 질문이요... Orange 2025-07-04
2700339 이거 결과값이 왜이런건지.. (4) 그댸와나 2025-07-04
2700313 파일 읽어서 저장하는데 빈파일일 경우 문재가 발생하네요.. (2) 크나 2025-07-03
2700287 구조체 동적할당 연습을 하는데 오류가 뜹니다...(해결) (3) 아련나래 2025-07-03
2700264 문자와 숫자 동시에 입력??? 글고운 2025-07-03
2700236 txt파일로만 쓰고 읽게 하려면 어떻게 해야 하나요..?? (8) 미국녀 2025-07-03
2700211 전위 연산자 (2) 어른처럼 2025-07-02
2700183 C에서 파일이름을 받고, 그 파일의 사이즈를 출력해줘야하는데 내용이 출력이 안되네요 ;ㅅ; 피스케스 2025-07-02
2700150 꼭좀 도와주세요ㅠㅠㅠ 호습다 2025-07-02
2700095 연산문제...질문... 오빤테앵겨 2025-07-01
2700070 while문 , 3의배수 출력하는 프로그램좀 짜주세욤. 횃불 2025-07-01
2700041 초보인데요 ㅎ 배열안에 배열을 집어넣을수 있나요?? 헛장사 2025-07-01
2700012 배열// (1) 전갈자리 2025-07-01
2699895 무한루프에 빠집니다.!! 해결좀부탁드려요 (10) 선아 2025-06-30
2699842 질문을 너무 많이 하네여.....죄송.... (2) 해님꽃 2025-06-29
2699816 오류 질문입니다.. (1) 해비치 2025-06-29
2699763 질문입니다 ! 꼭 좀 도와주세요ㅠㅠ (2) 미라 2025-06-28
2699555 c언어 다항식을 입력을 했는데 왜 출력이 안될까요? 피스케스 2025-06-27
<<  이전  1 2 3 4 5 6 7 8 9 10  다음  >>

수다닷컴 | 여러분과 함께하는 수다토크 커뮤니티 수다닷컴에 오신것을 환영합니다.
사업자등록번호 : 117-07-92748 상호 : 진달래여행사 대표자 : 명현재 서울시 강서구 방화동 890번지 푸르지오 107동 306호
copyright 2011 게시글 삭제 및 기타 문의 : clairacademy@naver.com