Advertisemen
Silly me, just found out there's an inbuilt method to sort a vector, now I feel like an idiot :(
mso 9]>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> toSort;
toSort.push_back(5);
toSort.push_back(3);
toSort.push_back(7);
sort(toSort.begin(),toSort.end());
for (int i=0;i<toSort.size();i++)
cout << toSort[i] << ", ";
cout << endl;
return 0;
}
Advertisemen
Tidak ada komentar:
Posting Komentar