C++小问题

[复制链接]
查看11 | 回复4 | 2012-1-10 21:32:52 | 显示全部楼层 |阅读模式
去重算法是指去掉连续出现的相同元素所以你需要先对list进行排序,然后在去重复制给vector #include#include#include#includeusing namespace std;int main(){int ia[]={1,2,3,4,10,5,10};list ilst(ia,ia+7);// 先对list进行排序ilst.sort();vector ivec;unique_copy(ilst.begin(),ilst.end(),back_inserter(ivec));vector...
回复

使用道具 举报

千问 | 2012-1-10 21:32:52 | 显示全部楼层
#include #include int main(){ std::list list={ 1,2,3,4,10,5,10 }; list.sort(); list.unique(); for (auto x : list) std::printf("%d ",x); r...
回复

使用道具 举报

千问 | 2012-1-10 21:32:52 | 显示全部楼层
什么问题?!!!!...
回复

使用道具 举报

千问 | 2012-1-10 21:32:52 | 显示全部楼层
我也不知道...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行