This outputs ----> 3 4
-which is correct but i would like to know how to swap elements to, say, make the output 4 3.
p.s. example.swap(3,4) //Error (swap takes 1 arg)
CODE:
#include <iostream.h>
#include <vector>
using namespace std;
int main()
{
vector <int> example;
example.push_back(3);
example.push_back(4);
for(int y=0; y<example.size(); y++)
cout<<example[y]<<" ";
cout<<endl;
return 0;
}