C++ 将数字从小到大排序

标签 c++ sorting numbers

如果我让用户输入 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/

相关文章:

c++ - 静态库中的符号可见性和操作

c++ - 你能让 Visual Studio 2005 为你的启动程序提供命令行参数吗?

android - 在网格布局的适配器中应用排序

比较文件的 Bash 脚本

c++ - 1/sqrt(x) 和 std::exp(-0.5 * std::log(x)) 之间的数值权衡

string - 数字到字符串 - 如何将 150 变成 "One Hundred and Fifty"

c++ - 家庭作业 : Read a file into a pointer-to-pointer char (char**)

c++ - C++ 中函数的特殊限定符

TCP序列号

PHP 分页排序结果