Mancolo

Untitled

Sep 25th, 2022
72
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int i, j, n = 5;
  6.     double mas[5];
  7.     for (i = 0; i < n; i++)
  8.     {
  9.         cin >> mas[i];
  10.     }
  11.     for (int i = 0; i < n - 1; i++)
  12.         if (mas[i] == mas[i + 1])
  13.         {
  14.             int sch = 1;
  15.             while (mas[i + sch] == mas[i]) sch++;
  16.             for (int j = i; j < n - 1; j++)
  17.                 mas[j] = mas[j + sch];
  18.             n -= sch;
  19.  
  20.         }
  21.     for (i = 0; i < n; i++)
  22.     {
  23.         cout << mas[i] << "\t";
  24.     }
  25.  
  26.     //system("pause");
  27. }
Comments
Add Comment
Please, Sign In to add comment