Advertisement
levimoosky

Untitled

May 26th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int c = 8;
  8.     int cegsorszam[8] = {1, 1, 3, 5, 1, 4, 3, 2};
  9.     int segedtomb[8];
  10.  
  11.     for(int i=0; i<c; ++i)
  12.         segedtomb[i] = 101;
  13.  
  14.     int p = 0;
  15.     int y = 0;
  16.  
  17.     for(int i=0; i<c; ++i)
  18.     {
  19.         p = 0;
  20.         for(int j=0; j<y; ++j)
  21.             if(cegsorszam[i] == segedtomb[j])
  22.                 ++p;
  23.         if(p==0)
  24.         {
  25.             segedtomb[y] = cegsorszam[i];
  26.             ++y;
  27.         }
  28.     }
  29.  
  30.     for(int i=0; i<y; ++i)
  31.         cout << segedtomb[i] <<  " ";
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement