除了显示平均,最高和最低温度之外,有没有办法打印出整个排序列表
Is there a way to print out the entire sorted lists in addition to displaying the average, highest and lowest temperature?
除了显示平均、最高和最低温度外,有没有办法打印出整个温度排序列表?
如果要打印整个排序列表,只需从temperatures[]
数组打印即可。
但是,对于排序,请包含<algorithm>
并使用sort()
函数。
将此代码附加到您的main()
中:
//Sorting the array in increasing order.
sort(temperatures,temperatures+days);
//Printing the sorted temperatures.
for (int i = 0; i < days; ++i)
cout<<temperatures[i]<<" ";
相关文章:
- 有没有办法搜索向量的元素,<String>然后检查它是否包含特定的字符,如果它确实打印了它
- 有没有一种方法可以使用图形在C++中逐个字母地打印控制台中的文本
- 当遇到不是来自 STL 的未捕获异常时,有没有办法打印其信息?
- 有没有办法用单行逻辑代码打印金字塔星形图案?面试官向我的朋友问了这个问题
- 有没有更简单的方法可以从用户那里获取三个数字并按升序打印它们?
- 有没有办法将字符串打印为文字?
- 有没有办法知道C++中将打印到标准输出的大小?
- 有没有办法打印包含当前文件的文件的文件名
- 有没有办法更快地打印2D阵列
- 有没有办法打印所有类数据
- 有没有办法在我的程序中打印所有声明的变量
- GDB有没有办法在不省略模板参数的情况下打印类型
- 有没有办法在不重载<<运算符的情况下打印出 std::list 的内容?
- 有没有一种方法可以在Netbeans中的断点处打印变量的值
- 有没有一种方法可以打印对象的位表示
- 除了显示平均,最高和最低温度之外,有没有办法打印出整个排序列表
- 有没有办法让 GDB 打印一些东西来告诉我一行已经执行,而不会停止
- 有没有办法创建一个公共输出流对象以在控制台上打印并打印到 c++ 中的文件
- 有没有办法通过 int 指针一次打印整数
- 有没有通过打印字符来播放动画的c程序?