Advertisement
codisinmyvines

dlya Ainura

Apr 28th, 2020
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. void fpunktV(ifstream& g1, ifstream& g2, ofstream& f)
  2. {
  3.     Podpischiki a;
  4.     Podpiska b;
  5.     PunktV c;
  6.     int i, l, k, s, j;
  7.     while (g1.peek() != EOF)
  8.     {
  9.         g1.read((char*)&a, sizeof(Podpischiki));
  10.         g2.seekg(0);
  11.         k = 0;
  12.         while (g2.peek() != EOF)
  13.         {  
  14.             g2.read((char*)&b, sizeof(Podpiska));
  15.             if (strcmp(a.surname, b.snamepod) == 0)
  16.             {
  17.                 l = strlen(a.country);
  18.                 for (i = 0; i < l; i++)
  19.                 {
  20.                     c.countryV[i] = a.country[i];
  21.                 }
  22.                 c.countryV[l] = '\0';
  23.                 c.indexV = a.index;
  24.                 s = strlen(b.nizdaniepod);
  25.                 for (i = 0; i < s; i++)
  26.                 {
  27.                     c.vseizd[k][i] = b.nizdaniepod[i];
  28.                 }
  29.                 c.vseizd[k][s] = '\0';
  30.                 k++;
  31.             }
  32.         }
  33.         for (j = k; j < 50; j++)
  34.         {
  35.             c.vseizd[j][0] = '\0';
  36.         }
  37.         f.write((char*)&c, sizeof(PunktV));
  38.     }
  39. }
  40. void showV(ifstream& f)
  41. {
  42.     PunktV a;
  43.     while (f.peek() != EOF)
  44.     {
  45.         f.read((char*)&a, sizeof(PunktV));
  46.         cout << a.countryV << " " << a.indexV << " ";
  47.         for (int i = 0; i < 50 && a.vseizd[i][0] != '\0'; i++)
  48.         {
  49.             cout << a.vseizd[i]<<" ";
  50.         }
  51.         cout << "\n";
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement