Okay I have a little assignment I need to sort a vector of strings using std::sort but it does not sort any "numbers" above two digest correctly. It is critical I use this API for the assignment.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<string> Nums = { "1", "5", "34", "3", "6", "12", "21" };
sort(Nums.begin(), Nums.end());
for (int i = 0; i < Nums.size(); i++)
{
cout << Nums[i] << endl;
}
system("PAUSE");
}
Result:
1
12
21
3
34
5
6
Press any key to continue . . .
Want:
1
3
5
6
12
21
34
sort. More info here: en.cppreference.com/w/cpp/algorithm/sort