我的anagram程序在我的dev-cpp中工作得很好,但是在任何在線測試人員都會在任何測試字符串上拋出錯誤的答案。有人能幫我嗎?Anagram程序測試
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char input1[10000];
char input2[10000];
cin >> input1;
getchar();
cin >> input2;
getchar();
int leng;
leng = strlen(input1);
bool output[leng];
for(int i=0; i<leng; i++){
for(int y=0; y<leng; y++){
if(input1[i] == input2[y]){
output[i] = true;
}
}
}
for(int o=0; o<leng; o++){
if((o+1) == leng){
if(output[o] == true){
cout << "ano" << endl;
break;
}
}else if(output[o] == true) {
continue;
}
cout << "nie" << endl;
break;
}
getchar();
return 0;
}
你能在你的問題中展示一個適合你的例子,但不能在線嗎? – agold
大概... kalerab mrkvicka ......在PC它拋出我的「不」,但在線「是」,但林不知道有關例子 – Xengo