回文字符串的判断

来源:互联网 发布:西南大学官网网络教育 编辑:程序博客网 时间:2024/06/05 06:50
#include<stdio.h>#include<stdlib.h>#include<string.h>int ishw(char*p){ char *start=p; char *end=p+strlen(p)-1; while(start<end) {  if(*start==*end)  {   start++;   end--;  }  else   return 0; } return 1;}int main(){ char s[10]; scanf("%s",s); if(ishw(s))  printf("是回文字符串"); else      printf("不是回文字符串"); system("pause"); return 0;}

本文出自 “liveyoung” 博客,转载请与作者联系!

0 0
原创粉丝点击