[Solved] How can i sort a string with integers in c++?
Here it’s done with std::sort from the header algorithm #include <iostream> #include <string> #include <algorithm> #include <vector> int main(){ std::vector<std::string> nums{ “922003001020293839297830207344987344973074734”, “766352786207892397340783784078348747606208602”, “182823068326283756515117829362376823572395775” }; std::cout << “unsorted: ” << std::endl; for (auto i : nums){ std::cout << i << std::endl; } std::sort(nums.begin(), nums.end()); //sort it std::cout << “\nsorted: ” << std::endl; for (auto i … Read more