Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- void ispremjesaj(vector<int>& brojevi) {
- swap(brojevi[0], brojevi[brojevi.size() - 1]);
- }
- void ispisi(vector<int>& brojevi) {
- for (auto it = brojevi.begin(); it != brojevi.end(); ++it) {
- cout << *it << endl;
- }
- }
- int main() {
- vector<int> brojevi;
- int n;
- cin >> n;
- int broj;
- for (int i = 0; i < n; i++)
- {
- cout << "Unesi " << (i + 1) << ". broj: ";
- cin >> broj;
- brojevi.push_back(broj);
- }
- ispremjesaj(brojevi);
- ispisi(brojevi);
- char a;
- cin >> a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement