题解 | #迭代器遍历set#

迭代器遍历set

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

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

相关推荐

xdm怎么说&nbsp;要被拷打了&nbsp;担心是KPI
丹田:面就完了,就当日薪四位数的大佬免费给给你面试。
点赞 评论 收藏
分享
06-12 10:50
门头沟学院 Java
你的不定积分没加C:我怎么在学院群看到了同样的话
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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