Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<conio.h>
- #define MAXTIT 50
- #define MAXAUT 30
- #define MAXBKS 100
- #define STOP ""
- struct book
- {
- char title[MAXTIT];
- char author[MAXAUT];
- float value;
- };
- void main (void)
- {
- struct book libry[MAXBKS];
- int count=0;
- int index;
- printf("Enter the book name: \n");
- printf("Press <Enter> in beginning string for stop.\n");
- while (strcmp(gets(libry[count].title),STOP)!=0 && count<MAXBKS)
- {
- printf("Enter the name author:\n");
- gets(libry[count].author);
- printf("Enter the price:\n");
- scanf(" %f ", &libry[count++].value);
- while (getchar()!='\n'); /* î÷èñòêà ñòðîêè ââîäà */
- if (count<MAXBKS)
- printf("Name the next book\n");
- }
- printf("List introduced a list of books\n");
- for(index=0; index<count; index++)
- printf("%s, %s, %f \n", libry[index].author, libry[index].title,
- libry[index].value);
- getch();
- }
Add Comment
Please, Sign In to add comment