标题:关于回文
取消只看楼主
流年226
Rank: 1
等 级:新手上路
帖 子:37
专家分:7
注 册:2013-4-27
结帖率:71.43%
已结贴  问题点数:10 回复次数:1 
关于回文
#include<stdio.h>
#include<string.h>
#define n 50
void main()
{
    int i,j,num=0;
    char st1[n+1];
    char str[100][n+1];
    char *pst1,*pst2;
    printf ("输入字符串:");
    while(1)
    {
      if(scanf("%s",st1)=='end')
          break;
      strcpy (str[num],st1);
      num++;   
    }
    for(j=0;j<num;j++)
    { pst1=str[j];
    pst2=str[j];
    while(*pst1!='\0')
        pst1++;
    i=0;
    pst1--;
    while(*pst1==*pst2 )
    {
        pst1--;
        pst2++;
        i++;
        if(i==strlen(str[j]))
            break;
    }
    if(i==strlen(str[j]))
        printf("该字符串回文\n");
    else
        printf("该字符串不回文\n");
    }
}


哪位帮忙看看哪错了?是看多个字符串是否回文,以end为结束标志。
搜索更多相关主题的帖子: include 字符串 
2013-05-05 19:58
流年226
Rank: 1
等 级:新手上路
帖 子:37
专家分:7
注 册:2013-4-27
得分:0 
好的,我再看看,谢谢
2013-05-06 15:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-406274-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.086396 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved