SHARE
TWEET

Untitled

ilyaaaaa Sep 18th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n;
  6.     cout << "vvedite ko-vo elementov: ";
  7.     cin >> n;
  8.     cout << endl;
  9.    
  10.     int *mass = new int(n);
  11.     for (int i = 0; i < n; i++)
  12.     {
  13.         cout << "mass[" << i << "] = ";
  14.         cin >> mass[i];
  15.     }
  16.  
  17.     for (int i = 0; i < n; i++)
  18.     {
  19.         for (int j = i + 1; j < n; j++)
  20.         {
  21.             if (mass[i] == mass[j])
  22.             {
  23.                 for (int v = i; v < n; v++)
  24.                 {
  25.                     mass[v] = mass[v + 1]; 
  26.                    
  27.                 }
  28.                 i--;
  29.                 n--;
  30.             }
  31.         }
  32.     }
  33.     cout << "new massiv: ";
  34.     for (int i = 0; i < n; i++)
  35.     {
  36.         cout << mass[i] << endl;
  37.     }
  38.  
  39.  
  40.     return 0;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top