35 lines
571 B
C++
35 lines
571 B
C++
#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;
|
|
}
|