Answer:
#include <iostream>
#include <vector>
using namespace std;
void swapfrontend(vector<int> &v)
{
int temp = v[0];
v[0] = v[v.size() - 1];
v[v.size() - 1] = temp;
}
int main()
{
vector<int> v;
int num;
cout << "Enter numbers to be inserted in the vector, then enter -1 to stop.\\";
cin >> num;
while (num != -1)
{
v.push_back(num);
cin >> num;
}
swapfrontend(v);
cout << "Here are the values in the vector:\\";
for (int i = 0; i < v.size(); i++)
cout << v[i] << endl;
return 0;
}