习题9.34 9.35 string中的iterator
#include<iostream> #include<string> using namespace std; int main() { //转换大写字符 /*string str = "hello world!"; for(string::iterator it=str.begin();it!=str.end();it++) { *it = toupper(*it); } cout<<str;*/ //删除大写字符 string str = "hello WwoRRlIId!"; for(string::iterator it=str.begin();it!=str.end();it++) { if(isupper(*it)) { str.erase(it); --it; } } cout<<str; }
posted on 2011-12-03 22:53 york_software123 阅读(148) 评论(0) 编辑 收藏 举报