Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////////////////////////////////
- // _________________________________________________ //
- // //
- // Лабораторная работа №4 //
- // _________________________________________________ //
- // //
- ///////////////////////////////////////////////////////
- #include <stdio.h>
- #define lmax 200
- //пропуск символов до конца строки
- #define CLR while (getchar()!='\n')
- struct book
- {
- struct publishers
- {
- char name[50], city[30];
- int year;
- };
- char author[20], title[60], nazv[100];
- int price, pages;
- };
- //Функция ввода массива структур (каталога)
- void readcat(int *kol, book cat[], book.publishers cat2[])
- { char ch;
- *kol=0;
- do
- { printf("Book # %d\n", ++(*kol));
- printf("Автор..........."); gets(cat->author);
- printf("Число страниц..."); scanf("%d", &cat->pages);
- printf("Цена............"); scanf("%d", &cat->price);
- printf("Название книги ..........."); gets(cat->nazv);
- printf("Год издания....."); scanf("%d", &cat2->year);
- printf("Название издательства........"); gets(cat2->name);
- printf("Город..........."); gets(cat2->city);
- CLR;
- printf("Продолжить? (y/n) ");
- ch=getchar();
- CLR;
- cat++; }
- while ((ch=='Y' || ch=='y')&&*kol<lmax);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement