vector<string> vs = {"abc","xyz","mnq"}; vector<string>::iterator itr = vs.begin(); for(; itr != vs.end(); itr++) { cout<<*itr<<endl; } for(auto &s : vs) { cout<<s<<endl; }
int arr[10] = {1,2,3,4,5,6,7}; for(auto &i: arr) { cout<<i<<endl; } string str = "china"; for(auto& ch: str) { cout<<ch<<endl; }
map<int,string> mis={ {1,"c++"}, {2,"java"}, {3,"python"} }; map<int,string>::iterator itr = mis.begin(); for(; itr != mis.end(); ++itr) { cout<<(*itr).first<<"\t"<<itr->second<<endl; } for(auto &pair: mis) { cout<<pair.first<<"\t"<<pair.second<<endl; }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。