Advertisement
PieInlaw

Egoru

Apr 10th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1. ///////////////////////////////////////////////////////
  2. // _________________________________________________ //
  3. //                                                   //
  4. //               Лабораторная работа №4              //
  5. // _________________________________________________ //
  6. //                                                   //
  7. ///////////////////////////////////////////////////////
  8.  
  9.  
  10. #include <stdio.h>
  11. #define lmax 200
  12. //пропуск символов до конца строки
  13. #define CLR while (getchar()!='\n')
  14.  
  15. struct book
  16. {
  17.     struct publishers
  18.     {
  19.         char name[50], city[30];
  20.         int year;
  21.     };
  22.    
  23.     char author[20], title[60], nazv[100];
  24.     int price, pages;
  25.  
  26. };
  27. //Функция ввода массива структур (каталога)
  28. void readcat(int *kol, book cat[], book.publishers cat2[])
  29. { char ch;
  30.     *kol=0;
  31.     do
  32.     { printf("Book # %d\n", ++(*kol));
  33.         printf("Автор..........."); gets(cat->author);
  34.         printf("Число страниц..."); scanf("%d", &cat->pages);
  35.         printf("Цена............"); scanf("%d", &cat->price);
  36.         printf("Название книги ..........."); gets(cat->nazv);
  37.         printf("Год издания....."); scanf("%d", &cat2->year);
  38.         printf("Название издательства........"); gets(cat2->name);
  39.         printf("Город..........."); gets(cat2->city);
  40.         CLR;
  41.         printf("Продолжить? (y/n) ");
  42.         ch=getchar();
  43.         CLR;
  44.         cat++; }
  45.     while ((ch=='Y' || ch=='y')&&*kol<lmax);
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement