标签:blog ack alt size lap title opened i++ oid
1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 5 class Solution { 6 public: 7 void replaceSpace(char *str,int length); 8 }; 9 10 void Solution::replaceSpace(char *str, int length) 11 { 12 vector<char> str1; 13 for(int i = 0; i < length; i++) 14 { 15 if(str[i] != ‘ ‘) 16 { 17 str1.push_back(str[i]); 18 } 19 20 else 21 { 22 str1.push_back(‘%‘); 23 str1.push_back(‘2‘); 24 str1.push_back(‘0‘); 25 } 26 } 27 28 for(int t = str1.size()-1; t >= 0; t--) 29 { 30 str[t] = str1[t]; 31 } 32 }
标签:blog ack alt size lap title opened i++ oid
原文地址:http://www.cnblogs.com/htzhang0908/p/6673545.html