标签:比较 else span stdio.h ble %s break while str
#include<stdio.h> #include<string.h> int huiwen(char *str) //定义回文函数 { //char ch[100]; int len=strlen(str); //获取字符串的长度 int i,j,temp; for(i=0,j=len-1;i<=j;i++,j--) //第一位和最后一位相比较循环判断 { if(str[i]==str[j]) // temp=1; else { temp=0; break; } } return temp; } main() { char ch[100]; //scanf("%s",&ch); //无法判断特殊字符如空格键; while(gets(ch)!=NULL) //可以判断键盘输入的任意字符 { if(huiwen(ch)) printf("Yes\n"); else printf("No\n"); } return 0; }
标签:比较 else span stdio.h ble %s break while str
原文地址:https://www.cnblogs.com/chenlong991223/p/10091002.html