Guest User

Untitled

a guest
Apr 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void main ()
  5.  
  6. {
  7.  
  8.  
  9. char arr1[5], arr2[5], arr3[5], i, j=1, k, h=0;
  10.  
  11.  
  12. cout <<"Please enter 5 numbers, two times"<< endl;
  13.  
  14.  
  15. for (i=0; i<5; i++)
  16. {
  17. cin >> arr1[i];
  18. }
  19.  
  20. for (k=0; k<5; k++)
  21. {
  22. cin >> arr2[k];
  23. }
  24.  
  25. for (i=0; i<5; i++)
  26. {
  27. for (k=0; k<5; k++)
  28. {
  29. if (arr1[i]==arr2[k])
  30. {
  31. arr3[h]=arr1[i];
  32. h++;
  33. }
  34. }
  35. }
  36.  
  37. for (i=0; i<5; i++)
  38. {
  39. cout<< arr3[i];
  40. }
  41.  
  42. system ("pause");
  43. }
Add Comment
Please, Sign In to add comment