Guest User

Untitled

a guest
Aug 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.05 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<conio.h>
  4. #define MAXTIT 50
  5.  
  6. #define MAXAUT 30
  7.  
  8. #define MAXBKS 100
  9.  
  10. #define STOP ""
  11.  
  12. struct book
  13.  
  14. {
  15.  
  16.  char title[MAXTIT];
  17.  
  18.  char author[MAXAUT];
  19.  
  20.  float value;
  21.  
  22. };
  23.  
  24. void main (void)
  25.  
  26. {
  27.  
  28.   struct book libry[MAXBKS];
  29.  
  30.   int count=0;
  31.  
  32.   int index;
  33.  
  34.   printf("Enter the book name: \n");
  35.  
  36.   printf("Press <Enter> in beginning string for stop.\n");
  37.  
  38.   while (strcmp(gets(libry[count].title),STOP)!=0 && count<MAXBKS)
  39.  
  40.   {
  41.  
  42.      printf("Enter the name author:\n");
  43.  
  44.      gets(libry[count].author);
  45.  
  46.      printf("Enter the price:\n");
  47.  
  48.      scanf(" %f ", &libry[count++].value);
  49.  
  50.      while (getchar()!='\n'); /* î÷èñòêà ñòðîêè ââîäà */
  51.  
  52.      if (count<MAXBKS)
  53.  
  54.          printf("Name the next book\n");
  55.  
  56.   }
  57.  
  58.   printf("List introduced a list of books\n");
  59.  
  60.   for(index=0; index<count; index++)
  61.  
  62.        printf("%s, %s, %f \n", libry[index].author, libry[index].title,
  63.                                                     libry[index].value);
  64.  
  65.   getch();
  66. }
Add Comment
Please, Sign In to add comment