#include<string.h> #include<stdio.h> #include<conio.h> #include<iostream.h> struct library { char name[50]; char avtor[50]; float cost; }; void main() { int k,p,n,i;k=0;p=0; char s[50]; clrscr(); cout<<"Vvedite kol-vo:\n"; cin>>n; library *a=new library[n]; clrscr(); for (i=0;i<n;i++) { cout<<"Name: "; cin>>a[i].name; cout<<"Avtor: "; cin>>a[i].avtor; cout<<"Cost: "; cin>>a[i].cost; cout<<"--------------------------------------------------------------------------------"; } cout<<"Enter the avtor for search: "; cin>>s; clrscr(); for (i=0;i<n;i++) if(strcmp(a[i].avtor,s)==0) {p++;k++;} if(k==0) cout<<"Error !!!"; else cout<<"Kol-vo knig avtora "<<s<<" : "<<p<<"\n"; getch(); } |