I have this following code where there is a vector of strings. Each string is an integer. I want to sort this in a descending order. The regular sort function did not solve my problem. Can someone point out how to do this? I want the output as 345366,38239,029323. I want the leading zero in 029323 as well.
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main() {
vector<string> v = {"345366", "029323", "38239"};
vector<int> temp(v.size());
for (int idx = 0; idx < v.size(); idx++)
temp[idx] = stoi(v[idx]);
sort(temp.begin(), temp.end()));
cout<<temp[0]<<" "<<temp[1]<<" "<<temp[2];
return 0;
}