Guest User

Untitled

a guest
Dec 11th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. void account_book(){
  2. FILE *book;
  3. book = fopen("book.txt","a+");
  4. long long int chiwhan_for_ISBN;
  5. int chiwhan_for_book_num;
  6. char answer;
  7. book_node *newnode = (book_node *)malloc(sizeof(book_node));
  8. book_node *tmp = head_book;
  9. system("clear");
  10. printf(">> 도서 등록<<\n");
  11. getchar();
  12. printf("도서명:");
  13. scanf("%[^\n]",newnode->book_name);
  14. getchar();
  15. printf("출판사:");
  16. scanf("%[^\n]",newnode->book_publisher);
  17. getchar();
  18. printf("저자명:");
  19. scanf("%[^\n]",newnode->book_writer);
  20. getchar();
  21. printf("ISBN:");
  22. scanf("%lld",&(newnode->ISBN));
  23. getchar();
  24. printf("소장처:");
  25. scanf("%[^\n]",newnode->locate_place);
  26. getchar();
  27. newnode->yes_or_no = 'Y';
  28. /*printf("\n자동입력 사항\n\n");
  29. printf("%lld",newnode->ISBN);
  30. */
  31. while (1) {
  32. if(tmp == NULL){
  33. head_book = newnode;
  34. tmp = head_book;
  35. break;
  36. }
  37. if (tmp->next == NULL){
  38. newnode->book_num = (tmp->book_num)+1;
  39. tmp->next = newnode;
  40. break;
  41. }
  42. tmp = tmp->next;
  43. }
  44. printf("대여가능 여부: Y\n");
  45. printf("도서번호 %d\n\n",newnode->book_num);
  46. printf("등록하시겠습니까?");
  47. scanf("%c",&answer);
  48. getchar();
  49. if(answer == 'Y' || answer == 'y')
  50. book_restore();
  51. else if(answer == 'N' || answer == 'n'){
  52. if(tmp->next ==NULL)
  53. tmp = NULL;
  54. else
  55. tmp->next == NULL;
  56. }
  57. }
Add Comment
Please, Sign In to add comment