여기 해더파일(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])
}
}
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2655576 | 구조체 선언 질문입니다. | 통꽃 | 2024-05-21 |
2655547 | 변수선언과 printf만 사용해서 수식 짜기 (1) | 피리 | 2024-05-20 |
2655523 | 문자열 사이에 문자열삽입 | 바람 | 2024-05-20 |
2655491 | 키보드 인식, 랜덤 함수 or 헤더 (2) | 별 | 2024-05-20 |
2655471 | 링 버퍼 구현된 소스 인데요.. 이해가 잘안되서요.. | 소심한녀자 | 2024-05-20 |
2655440 | test파일이 안 되요. (2) | 리라 | 2024-05-19 |
2655416 | 고수님들 도움이 절실합니다. (2) | 세리 | 2024-05-19 |
2655361 | 엔터 입력받을때까지 기다리는 getchar (1) | 큰모음 | 2024-05-19 |
2655328 | 함수에서 포인터 (3) | 모아 | 2024-05-18 |
2655299 | 아이콘바꾸는법..? | 소 | 2024-05-18 |
2655271 | scanf 입력받으면 쭉 실행되는.. (5) | ComeOn | 2024-05-18 |
2655184 | 이 세개 프로그램좀 해결해주실.... 고수님들???? (3) | 말달리자 | 2024-05-17 |
2655129 | 다차원 배열 원소들 주소계산하는거 질문이요~ | 터전 | 2024-05-17 |
2655103 | AVRstudio MoveAxis. MoveLine 함수질문 | 앨버트 | 2024-05-16 |
2655072 | 콘솔창의 위치와 크기를 정하고 싶습니다. | 딥레드 | 2024-05-16 |
2655044 | 자료구조랑 online judge site에 대해서 질문있습니다... (1) | 뽀송뽀송 | 2024-05-16 |
2655016 | 별찍기 문제 중 이해안되는 부분이 있어요... | 도전중 | 2024-05-16 |
2654986 | 입력받은 성적을 배열에 저장하기 (3) | 안녕나야 | 2024-05-15 |
2654959 | ===========-이런거 미리 지정하는법 (1) | 김자영 | 2024-05-15 |
2654930 | 도와주십시요 ㅜㅜ 자료구조 ㅜㅜ | 도널드 | 2024-05-15 |