如果我让用户输入 10 个随机数,并且我想将它们从小到大排序,那么使用最基本的 C++ 语言执行此操作的最佳方法是什么。
最佳答案
std::vector<int> numbers;
// get the numbers from the user here.
std::sort(numbers.begin(), numbers.end());
关于C++ 将数字从小到大排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5101997/