Advertisement
ilyaaaaa

Untitled

Sep 21st, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n;
  6.     cout <<"vvedite kol-vo elementov v massive:"<< endl;
  7.     cin >> n;
  8.  
  9.     int* mass = new int(n);
  10.  
  11.     for (int i = 0; i < n; i++)
  12.     {
  13.         cout << "[" << i << "] = ";
  14.         cin >> mass[i];
  15.     }
  16.  
  17.  
  18.     int count = 0;
  19.  
  20.  
  21.     for (int i = 0; i < n; ++i)
  22.     {
  23.         int j;
  24.         for (j = i + 1; j < n && mass[j] != mass[i]; ++j);
  25.         {
  26.             count += j == n;
  27.         }
  28.     }
  29.  
  30.  
  31.  
  32.  
  33.     cout << "Kol-vo razn. elem. = " << count;
  34.  
  35.            
  36.        
  37.          
  38.             delete[] mass;
  39.             return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement