y‰SŽÒнŒ}zC/C++Ž ..
695:ƒfƒtƒHƒ‹ƒg‚Ì–¼–³‚µ‚³‚ñ
08/02/25 14:32:38
>>693
‚Å‚«‚邼
>>694
ƒoƒCƒiƒŠƒf[ƒ^‚à–â‘è‚È‚¢
#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="hogehogehogehogehoge";
replace(str, "geho", "(^_^)");
cout << str << endl;
int N=300*1024*1024;
char *ch=new char [N];
for(int n=0;n<N;n++)ch[n]=n; //‹‘å‚ȃoƒCƒiƒŠ”z—ñ
string str2(ch,N);
replace(str2, "geho", "(^_^)");
cout << str2 << endl;
}
ŽŸƒy[ƒW‘±‚«‚ð•\ަ1‚ð•\ަÅVƒŒƒX•\ަƒXƒŒƒbƒh‚ÌŒŸõ—ÞŽ—ƒXƒŒˆê——˜b‘è‚̃jƒ…[ƒX‚¨‚Ü‚©‚¹ƒŠƒXƒg¥ƒIƒvƒVƒ‡ƒ“‚ð•\ަ‰É‚‚Ԃµ2ch
4987“ú‘O‚ÉXV/243 KB
’S“–:undef