Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> // Для использования функции cout
- #include <cstdlib> // Для использования функции atoi
- #include <vector> // Для использования класса вектор STL
- using namespace std;
- int main()
- {
- setlocale(0,"");
- vector<int> iVec;
- int n, q,x,y;
- cout << "Введите x: ";
- cin >> x;
- cout << "Введите y: ";
- cin >> y;
- cout << "Введите размерность n: ";
- cin >> n;
- for (int i = 0; i < n; i++)
- {
- cout << "Введите элемент " << i << " - ";
- cin >> q;
- iVec.push_back(q);
- }
- iVec.insert(iVec.begin()+((n/2)+1), y);
- iVec.insert(iVec.begin()+((n/2)), x);
- for (vector <int>::iterator iter = iVec.begin(); iter < iVec.end(); iter++)
- cout << *iter << endl;
- system("pause");
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement