35 lines
571 B
C++
Raw Permalink Normal View History

2021-03-11 11:24:36 -05:00
#include <iostream>
#include <vector>
using namespace std;
/* Your solution goes here */
void SwapVectorEnds(vector<int>& v){
int temp;
temp = v.at(0);
v.at(0) = v.at(v.size()-1);
v.at(v.size()-1) = temp;
}
int main() {
vector<int> sortVector(4);
unsigned int i;
int userNum;
for (i = 0; i < sortVector.size(); ++i) {
cin >> userNum;
sortVector.at(i) = userNum;
}
SwapVectorEnds(sortVector);
for (i = 0; i < sortVector.size(); ++i) {
cout << sortVector.at(i) << " ";
}
cout << endl;
return 0;
}