請問各位大大
我這樣寫到底錯在哪裡呢??
#include <iostream>
using namespace std;
int main()
{
do
{
char input[999];
int size = 0;
int flag = 0;
cin.get(input,999);
while(input[size] != '\0')size++;
for(int i=0;i<size;i++)
{
if(input[i]!=input[size-1-i])flag++;
else flag+=0;
}
if(flag == 0)cout << "yes" << endl;
else cout << "no" << endl;
}while(cin.get() != EOF);
return 0;
}
想很久還是搞不懂 @@
麻煩各位幫我解答了~感謝
改成下面那樣就過了
#include <iostream>
using namespace std;
int main()
{
char input[999];
while(cin >> input)
{
int size = 0;
int flag = 0;
//cin.get(input,999);
while(input[size] != '\0')size++;
for(int i=0;i<size;i++)
{
if(input[i]!=input[size-1-i])flag++;
else flag+=0;
}
if(flag == 0)cout << "yes" << endl;
else cout << "no" << endl;
}//while(cin.get() != EOF);
return 0;
}