Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <algorithm>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int n, s, x, k = 0;
- cout << "Размер массива =";
- cin >> n;
- int m =2*n;
- int *mas = new int[m];
- for (int i = 0; i < n; ++i)
- {
- cout << "mas[" << i + 1<< "]=";
- cin >> mas[i];
- }
- cout << "Вставка =";
- cin >> s;
- cout << "Конец числа =";
- cin >> x;
- for (int i = 0; i < n; ++i)
- {
- if ((mas[i] % 10) == x)
- {
- for (int j = n; j > i; j--)
- mas[j] = mas[j - 1];
- n++;
- mas[i + 1] = s;
- }
- }
- for (int i = 0; i < n; ++i)
- cout << mas[i] << "\t";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement