y‰SŽÒнŒ}zC/C++Ž ..
[2ch|¥Menu]
691:ƒfƒtƒHƒ‹ƒg‚Ì–¼–³‚µ‚³‚ñ
08/02/25 14:12:57
>>686
‚±‚ê‚Å‚¢‚¢‚Ì‚©H
#include <string>
#include <iostream>
using namespace std;
void replace(string& str, string p, string q)
{
int i = str.find(p);
while (i >= 0) {
str.replace(i, p.length(), q);
i = str.find(p, i + q.length());
}
}
int main()
{
string str = "abcdabcd";
replace(str, "bc", "BC");
cout << str << endl;
}


ŽŸƒy[ƒW
ÅVƒŒƒX•\ަ
ƒXƒŒƒbƒh‚ÌŒŸõ
—ÞŽ—ƒXƒŒˆê——
˜b‘è‚̃jƒ…[ƒX
‚¨‚Ü‚©‚¹ƒŠƒXƒg
¥ƒIƒvƒVƒ‡ƒ“‚ð•\ަ
‰É‚‚Ԃµ2ch

4987“ú‘O‚ÉXV/243 KB
’S“–:undef