C++面向对象程序设计 038:白给的list排序 ---- (北大Mooc)


专题博客链接

北大C++ POJ课后习题博客全解记录


原题题目

在这里插入图片描述

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <list>
using namespace std;
int main()
{
    
    	
	double a[] = {
    
    1.2,3.4,9.8,7.3,2.6};
	list<double> lst(a,a+5);
	lst.sort(
// 在此处补充你的代码
);
	
	for(list<double>::iterator i  = lst.begin(); i != lst.end(); ++i) 
		cout << * i << "," ;
    return 0;
}

代码实现

greater<double>()

猜你喜欢

转载自blog.csdn.net/qq_37500516/article/details/115031858
今日推荐