Guest User

Untitled

a guest
Jan 12th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. // Алгоритм 71
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "iostream"
  6. #include <iomanip>
  7.  
  8. using namespace std;
  9.  
  10.  
  11. int main()
  12. {
  13.     setlocale(0, "");
  14.     cout << "Введите последовательность (ctrl+z закончить ввод последовательности)" << endl;
  15.     int n, past;
  16.     cin >> n;
  17.     past = n;
  18.     int kolvo = 1;
  19.     int max_kolvo = kolvo;
  20.     bool check = false;
  21.     while (cin >> n)
  22.     {
  23.         if (n == 0 && check == false) { check = true; }
  24.         if (n == 0 && past == 0)
  25.         {
  26.             ++kolvo;
  27.         }
  28.         past = n;
  29.         if (kolvo > max_kolvo) { max_kolvo = kolvo; }
  30.         if (n != 0) { kolvo = 1; }
  31.     }
  32.     if (check == false) { cout <<"Kolvo " <<0; }
  33.     if (check == true) { cout << "Kolvo " << max_kolvo; }
  34.    
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment