Advertisement
STANAANDREY

9/4/2019

Apr 9th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  int v[1000],m[1000],n,i,j,ok,k;
  7.  
  8.  cout<<"n=";cin>>n;
  9.  for (i=0;i<n;i++) {
  10.    cout<<"v["<<i<<"]=";
  11.   cin>>v[i];
  12.  }
  13.  k=0;
  14.   for (i=0;i<n;i++)
  15.   {
  16.       ok=1;
  17.        for (j=0;j<n;j++)
  18.         if (v[i]==v[j]&&j!=i)
  19.           ok=0;
  20.           if (ok)
  21.             {
  22.             m[k]=v[i];
  23.             k++;
  24.             }
  25.   }
  26.  
  27.  for (i=0;i<k;i++)
  28.   cout<<"m["<<i<<"]="<<m[i]<<endl;
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement