20hometown专题

把字符串中的每个空格替换程“%20”,例如输入“I love my hometown”,输出为”I%20love%20my%20hometown”

c++代码 #include<iostream>using namespace std;void replaceBlank(char *str){if (str == NULL)return;int originalLength = 0, blank = 0, i = 0;int newLength,originalIndex,newIndex;while (str[i] != '\0'