hozer

VitasLamer007

Nov 7th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. void main()
  5. {
  6.     int suka[5] = { 1, 2, 6, 5, 4 };
  7.     int pidorasi[5] = { 5, 4, 9, 7, 8 };
  8.     int unik[10];
  9.     int i, j, ns = 5, np = 5, unik_index = 0;
  10.  
  11.     for (i = 0; i < ns; i++)
  12.     {
  13.         unik[unik_index++] = suka[i];
  14.     }
  15.  
  16.     for (i = 0; i < np; i++)
  17.     {
  18.         int chi_e = 0;
  19.         for (j = 0; j < unik_index; j++)
  20.         {
  21.             if (pidorasi[i] == unik[j]) chi_e++;
  22.         }
  23.         if (chi_e == 0)
  24.         {
  25.             unik[unik_index++] = pidorasi[i];
  26.         }
  27.     }
  28.  
  29.     for (j = 0; j < unik_index; j++)
  30.         std::cout << unik[j] << " ";
  31.  
  32.     std::cin.ignore();
  33.     std::cin.get();
  34. }
Advertisement
Add Comment
Please, Sign In to add comment