Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. setlocale(LC_ALL, "Russian");
  6. int n, m,i,j;
  7. n = 0;
  8. cout << "Введите размер массива 1 ";
  9. cin >> n;
  10. int a[50];
  11. for (int i = 0; i < n; i++)
  12. {
  13. cout << "Введите число ";
  14. cin >> a[i];
  15. }
  16. cout << "Введите размер массива 2 ";
  17. cin >> m;
  18. int b[50];
  19. for (int i = 0; i < m; i++)
  20. {
  21. cout << "Введите число ";
  22. cin >> b[i];
  23. }
  24. for (i = 0; i < n; i++)
  25. {
  26. for (j = 0; j < m; j++)
  27. {
  28. if (a[i] == b[j])
  29. {
  30. int c[50];
  31. for (int i = 0; i < 50; i++)
  32. c[i] = a[i];
  33.  
  34. cout << c[i] << " ";
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement