文件名称:Judgment_palindrome
介绍说明--下载内容均来自于网络,请自行研究使用
编写一个函数palin()用来检查一个字符串是否正向拼写与反向拼写都一样的“回文”(palindromia)。如“MADAM”就是一个回文。若放宽要求,即忽略大小写字母的区别、忽略空格及标点符号等,则像“Madam,I m Adam.”之类的短语也可视为回文。编程要求:⑴在主函数中输入字符串。⑵将字符串首指针作为函数参数传递到函数palin()中。当字符串是回文时,要求函数palin()返回1,否则返回0。⑶若是回文,在主函数中输出"Yes.";若不是回文,在主函数中输出"No."。
提示:在函数palin()中,定义两个指针变量,分别指向字符串首部及尾部,判断它们指向的字符相等后,头指针head向后移动一个字符位置,尾指针tail向前移动一个字符位置,遇空格或标点符号等则跳过。直到能判断出结果。
-Write a function palin () is used to check whether a string forward and reverse spelling of the same spelling of " palindrome" (palindromia). Such as " MADAM" is a palindrome. If you relax the requirement that ignores the difference between uppercase and lowercase letters, ignoring spaces and punctuation, etc., is like " Madam, I' m Adam." Like the phrase can also be seen as a palindrome. Programming requirements: ⑴ input string in the main function. ⑵ the first pointer to the string passed to the function palin () as a function parameter. When the string is a palindrome, requiring function palin () returns 1, otherwise it returns 0. ⑶ If palindrome, in the main function output " Yes." If it is a palindrome, output " No." In the main function. Tip: In function palin (), define two pointer variable, pointing to the first string and tail, they point to the character after the judgment equal to the head pointer head moves backward one chara
提示:在函数palin()中,定义两个指针变量,分别指向字符串首部及尾部,判断它们指向的字符相等后,头指针head向后移动一个字符位置,尾指针tail向前移动一个字符位置,遇空格或标点符号等则跳过。直到能判断出结果。
-Write a function palin () is used to check whether a string forward and reverse spelling of the same spelling of " palindrome" (palindromia). Such as " MADAM" is a palindrome. If you relax the requirement that ignores the difference between uppercase and lowercase letters, ignoring spaces and punctuation, etc., is like " Madam, I' m Adam." Like the phrase can also be seen as a palindrome. Programming requirements: ⑴ input string in the main function. ⑵ the first pointer to the string passed to the function palin () as a function parameter. When the string is a palindrome, requiring function palin () returns 1, otherwise it returns 0. ⑶ If palindrome, in the main function output " Yes." If it is a palindrome, output " No." In the main function. Tip: In function palin (), define two pointer variable, pointing to the first string and tail, they point to the character after the judgment equal to the head pointer head moves backward one chara
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Judgment_palindrome.c
Judgment_palindrome.exe