Advertisement
ilyaaaaa

Untitled

Oct 19th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.    
  7.     int n;
  8.     cout << "razmer: ";
  9.     cin >> n;
  10.  
  11.     int* mass = new int[n];
  12.  
  13.     for (int i = 0; i < n; i++)
  14.  
  15.     {
  16.         cout << "[" << i << "] = ";
  17.         cin >> mass[i];
  18.     }
  19.  
  20.     for (int i = 0; i < n; i++)
  21.     {
  22.         cout << mass[i];
  23.     }
  24.     cout << endl;
  25.    
  26.     int kolvo=n;
  27.  
  28.     for (int i = 0; i < n; i++)
  29.     {
  30.         for (int j = 0; j < n; j++)
  31.         {
  32.             if (mass[i] == mass[j] && i!=j)
  33.             {
  34.                 for (int d = j; d < n-1; d++)
  35.                 {
  36.                     mass[d] = mass[d + 1];
  37.                 }
  38.                 n--;
  39.                 kolvo--;
  40.  
  41.  
  42.             }
  43.         }
  44.     }
  45.     cout << endl;
  46.     cout << "kolvo:" << kolvo << endl;
  47.     for (int i = 0; i < n; i++)
  48.     {
  49.         cout << mass[i];
  50.     }
  51.  
  52.  
  53.    
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement