題目是,用字符串c替換掉字符串a中所有的b片段。#include <iostream>#include <string>#include <stdio.h>int main() {std::string a, b, c;std::cin >> a >> b >> c;while (a.find(b) != -1) {int i = a.find(b);a = a.replace(b, c);}std::cout << a << std::endl;return 0;} 為什么replace那行通不過編譯?謝謝指點哦。
添加回答
舉報
0/150
提交
取消
