题解 | #迭代器遍历set#

迭代器遍历set

https://www.nowcoder.com/practice/7e57c0f7af86429db20c70053f23ea96

#include<bits/stdc++.h>
using namespace std;
int main(){
	set<int>s;
	// write your code here......
	int num;
	for(int i=0;i<5;i++)
	{
		cin>>num;
		s.insert(num);
	}
	for(set<int>::iterator it=s.begin();it!=s.end();it++)
	{
		cout<<*it<<" ";
	}
	return 0;
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-02 17:58
点赞 评论 收藏
分享
认真搞学习:这么良心的老板真少见
点赞 评论 收藏
分享
xdm怎么说&nbsp;要被拷打了&nbsp;担心是KPI
丹田:面就完了,就当日薪四位数的大佬免费给给你面试。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务