除了显示平均,最高和最低温度之外,有没有办法打印出整个排序列表

Is there a way to print out the entire sorted lists in addition to displaying the average, highest and lowest temperature?

本文关键字:打印 有没有 排序 列表 显示 最低温度      更新时间:2023-10-16

除了显示平均、最高和最低温度外,有没有办法打印出整个温度排序列表?

如果要打印整个排序列表,只需从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]<<" ";