Runtime error:#1082 : The Marshtomp has seen it all before

0
0

提交OJ,提示runtime error,但本地是通过的,求大神帮忙看下两个子函数出错在哪!

include

include

using namespace std;

char ToLower(char _c); void replace(char* ptr,char* oldChar,char* newChar);

const int len=201;

int main() { char* oldChar="marshtomp"; char* newChar="fjxmlhx"; char* ptr=new char[len];

while(!cin.eof())
{
    cin.getline(ptr,len);
    replace(ptr,oldChar,newChar);
    cout<<ptr<<endl;
}

return 0; }

char ToLower(char _c) { if(_c<'Z'&&_c>'A') { _c=_c+'a'-'A'; } return _c; }

void replace(char* ptr,char* oldChar,char* newChar) { for(int i=0;i<=strlen(ptr)-strlen(oldChar);i++) { char tempChar=ToLower(ptr[i]); if(tempChar==oldChar[0]) { int st=i; int index=0; while(ToLower(ptr[++st])==oldChar[++index]) { if(index==strlen(oldChar)-1) { int k; for(k=0;k

0 answer(s)

write answer 切换为英文 切换为中文


转发分享