Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.24 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct muzik
  5. {
  6.     char familiya[20];
  7.     int god;
  8.     char country[20];
  9.     char instr[20];
  10.  
  11. }*info;
  12.  
  13. void in(int);
  14. void out(int);
  15. int task(char,int,int,int );
  16.  
  17. int main()
  18. {
  19.     int n;
  20.     int i;
  21.     int count = 0;
  22.     char inst[20];
  23.     cout << "vvedite kol=vo uchastnikov ";
  24.     cin >> n;
  25.     info = new muzik[n];
  26.     in(n);
  27.     for ( i = 0; i < n; i++)
  28.     {
  29.         out(i);
  30.     }
  31.     cout << " vvedine instrument "; cin>> inst;
  32.  
  33.    
  34.    
  35.     cout << " kol-vo uchastnikov po zadannomu instrumentu " << task( *inst,  count,  i,  n);
  36.     cout << "\n\n";
  37.    
  38.  
  39.     delete[]info;
  40. }
  41.  
  42. void in(int n)
  43. {
  44.     for ( int i = 0; i < n; i++)
  45.     {
  46.         cout << "familiya "; cin >> (info + i)->familiya;
  47.         cout << " god rozhdeniya "; cin >> (info + i)->god;
  48.         cout << " strana "; cin >> (info + i)->country;
  49.         cout << " instrument "; cin >> (info + i)->instr;
  50.     }
  51.     cout << "\n\n";
  52. }
  53. void out(int i)
  54. {
  55.     cout << "\n\n";
  56.     cout << " familiya->" << (info + i)->familiya << "\t\t god rozhdeniya->" << (info + i)->god << "\t\t strana->" << (info + i)->country << "\t\t instrument->" << (info + i)->instr << endl;
  57. }
  58. int task(char inst,int count,int i,int n)
  59. {
  60.     for(i=0;i<n;i++)
  61.         if (*(info+i)->instr==inst)
  62.         {
  63.             count++;
  64.             out(i);
  65.         }
  66.  
  67.     return count;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement