Advertisement
Pafnytiu

массивы 5 - 9

Dec 14th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4. using namespace std;
  5. int main()
  6. {
  7. setlocale(LC_ALL, "Russian");
  8. int n, s, x, k = 0;
  9. cout << "Размер массива =";
  10. cin >> n;
  11. int m =2*n;
  12. int *mas = new int[m];
  13. for (int i = 0; i < n; ++i)
  14. {
  15. cout << "mas[" << i + 1<< "]=";
  16. cin >> mas[i];
  17. }
  18. cout << "Вставка =";
  19. cin >> s;
  20. cout << "Конец числа =";
  21. cin >> x;
  22. for (int i = 0; i < n; ++i)
  23. {
  24. if ((mas[i] % 10) == x)
  25. {
  26. for (int j = n; j > i; j--)
  27. mas[j] = mas[j - 1];
  28. n++;
  29. mas[i + 1] = s;
  30. }
  31. }
  32. for (int i = 0; i < n; ++i)
  33. cout << mas[i] << "\t";
  34. system("pause");
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement