<分区>
我刚刚编译了这个程序,但它似乎不起作用。
我应该做的是编写一个程序来确定一个单词是否为回文(前后相同的单词,例如“racecar”或“eye”)。
它还应该忽略大小写字母(例如 Racecar 或 eYe)。这是我目前所拥有的:
int main()
char word[21],reverse[21];
printf("Type a word and I will tell you if it is a Palindrome: ");
fgets(word,21,stdin);
puts("");
printf("The word that you typed is: %s \n",word);
strcpy(reverse,word);
strrev(reverse);
if((strcmp(reverse,word))==0)
printf("This word is a palindrome");
else
printf("This word is NOT a palindrome");
return 0;
}