Advertisement
Norbysweg

sorozat

Oct 21st, 2021
857
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.     int n,h=0, hmax=0;
  9.     ifstream fin("be.txt");
  10.     while(!fin.eof())
  11.     {
  12.          fin>>n;
  13.          if(n%2==0)
  14.             h++;
  15.          else
  16.          {
  17.              if(h>hmax)
  18.                 hmax=h;
  19.              h=0;
  20.          }
  21.     }
  22.     if(h>hmax)
  23.         hmax=h;
  24.     fin.close();
  25.     ofstream fout("ki.txt");
  26.     fout<<hmax;
  27.     fout.close();
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement