Reverse Words in a String
摘要:
1 void reverseWords(string &s) { 2 string res = "", tmp = ""; 3 int l = s.length(); 4 int i = 0; 5 while(i < l){ 6 if(s[i] != ' ') 7 tmp += s[i++]; 8 else{ 9 if(tmp != ""){10 if(res == ""... 阅读全文
posted @ 2014-03-11 20:48 waruzhi 阅读(129) 评论(0) 推荐(0) 编辑