Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void account_book(){
- FILE *book;
- book = fopen("book.txt","a+");
- long long int chiwhan_for_ISBN;
- int chiwhan_for_book_num;
- char answer;
- book_node *newnode = (book_node *)malloc(sizeof(book_node));
- book_node *tmp = head_book;
- system("clear");
- printf(">> 도서 등록<<\n");
- getchar();
- printf("도서명:");
- scanf("%[^\n]",newnode->book_name);
- getchar();
- printf("출판사:");
- scanf("%[^\n]",newnode->book_publisher);
- getchar();
- printf("저자명:");
- scanf("%[^\n]",newnode->book_writer);
- getchar();
- printf("ISBN:");
- scanf("%lld",&(newnode->ISBN));
- getchar();
- printf("소장처:");
- scanf("%[^\n]",newnode->locate_place);
- getchar();
- newnode->yes_or_no = 'Y';
- /*printf("\n자동입력 사항\n\n");
- printf("%lld",newnode->ISBN);
- */
- while (1) {
- if(tmp == NULL){
- head_book = newnode;
- tmp = head_book;
- break;
- }
- if (tmp->next == NULL){
- newnode->book_num = (tmp->book_num)+1;
- tmp->next = newnode;
- break;
- }
- tmp = tmp->next;
- }
- printf("대여가능 여부: Y\n");
- printf("도서번호 %d\n\n",newnode->book_num);
- printf("등록하시겠습니까?");
- scanf("%c",&answer);
- getchar();
- if(answer == 'Y' || answer == 'y')
- book_restore();
- else if(answer == 'N' || answer == 'n'){
- if(tmp->next ==NULL)
- tmp = NULL;
- else
- tmp->next == NULL;
- }
- }
Add Comment
Please, Sign In to add comment