题目1192:回文字符串--------自从用了char*后,感觉好多题都简单了

#include<stdio.h>
#include<stdlib.h>
#include<cstring>
int main()
{
    char *str=(char *)malloc(sizeof(char));
    while(scanf("%s",str)!=EOF)
    {
        int len,i;
        len=strlen(str);
        bool flag=true;
        for (i=0;i<len;i++)
         if (str[i]!=str[len-1-i])
            flag=false;
        if (flag) printf("Yes!\n");
        else printf("No!\n"); 
    }
    return 0;
}

 

posted @ 2017-03-06 14:48  贱人郭  阅读(127)  评论(0编辑  收藏  举报