여기 해더파일(1)과 (2)를 합칠 수 있는지 궁금하고요, 미작성된부분(1)(2)(3) 좀 돠주세요
한국드립
/* 도서 정리 프로그램 */
#include stdio.h
#include book.h
int getuser command();
void getbookinformation(book *p, int n, int index); // 저자이름과 같은 걸 찾는 함수.
void showbookwithauthormain(book *p, int n);
#define max_number 100
int main(int argc, char* argv[])
{
book books[max_number];
int cmd, index=0;
while(1)
{ cmd = getusercommand();
switch(cmd)
{
case 1:
getbookinfomain(books, max_number, index);
index++;
break;
case 2:
showbookwithauthor(books, index);
break;
case 3:
showbookwithtitlwmain(books, index);
break;
}
if(cmd == 4) break;
}
return 0;
}
int getusercammand()
{
int cmd
while(1)
{
printf(\t1. 도서 입력\n wt2. 저자별 검색\n\t3. 제목 검색\n\t4. 끝);
printf(명령 : );
sacanf(%d, &cmd);
if (cmd 1 \ cmd 4){
printf(없는 메뉴입니다. 다시 선택하시오.\n);
continue;
}
break;
}
fflush(stdin);
return 0;
}
void getbookinfomain(book *p, int n, int index)
{
p[index] = getbookinfo();
showbookinfo(&p[index]);
}
void showbookwithauthor(book *p, int n);
{
/*미작성 된부분(1)*/
}
void showbookwithtitlemain(book *p, int n)
{
/*미작성 된부분(2)*/
}
/*여기는 해더파일 입니다(1)*/
#ifndef
#define book_h
type struc book_tag
{
char title[200]
char author[40]
char publisher[20]
int year, month, day, price;
}
book;
book getbookinfo();
void showbookinfo(book *pbook);
void showbookinfos(book *pbook, int n, char author[]);
void showbookwithtitle(book *pbook, int n, char title[]);
#endif
/*여기는 해더파일 입니다(2)*/
#include stdio.h
#include string.h
#include book.h
book getbookinfo()
{
book book;
printf(새 책 정보 입력 ==========\n);
printf(제목 : ); gets(book, title);
printf(저자 : ); gets(book, author);
printf(출판사 : ); gets(book, publisher);
printf(출판일 : );
scanf(%d %d %d, &book.year, &book.month, &book.day);
printf(가격 : );
scan(%d, book.price);
return book;
}
void showbookinfo(book *pbook)
{
printf(------------------------------------------\n);
printf(제목 : %s\n, pbook-title);
printf(저자 : %s\n, pbook-author);
printf(출판사 : %s\n, pbook-publisher);
printf(출판일 : %4d년 %d월 %d일\n, pbook-year, pbook-month, pbook-day);
printf(가격 : %d\n, pbook-price);
}
void showbookinfos(book *book, int n)
{
/*미작성된부분(3)*/
}
void showbookwithauthor(book *pbook, int n, char author[])
{
int i;
for( i=0, in, i++)
{
if(!strcmp(pbook[i].author, author))
{
showbookinfo(&pbook[i]);
}
}
}
void showbookwithtitle(book *pbool, int n, char title)
{
int i;
for( i=0, in, i++)
{
if(!strcmp(pbook[i].title, title))
{
showbookinfo(&pbook[i])
}
}
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2700510 | c언어를 어케하면 잘할수 있을까요.. | 연연두 | 2025-07-05 |
2700484 | 두 개가 차이가 뭔지 알려주세요...(소수 찾는 프로그램) (2) | 날위해 | 2025-07-05 |
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 |