1 / 3
文档名称:

判断字符串是否为回文数.doc

格式:doc   大小:24KB   页数:3页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

判断字符串是否为回文数.doc

上传人:mh900965 2018/4/22 文件大小:24 KB

下载得到文件列表

判断字符串是否为回文数.doc

文档介绍

文档介绍:源代码:
#include<>
#include<>
#define null 0
#define max 50
typedef struct sn{
char data;
struct sn *next;
}node;
int ishw(node *head,int n){
char stack[max];
    int top=0;
    node *p;
    p=head->next;
    while(top<n/2)
    {
        stack[top]=p->data;
        top++;
        p=p->next;
    }
    top--;
    if(n%2==1) p=p->next;
    while(top>=0)
    {
        if(stack[top]!=p->data) return 0;
        top--;
        p=p->next;
    }
    return 1;
}
int push(node *head,char *s)
{   int i;
node *p,*q;
    p=head;
    for(i=0;s[i]!='@';i++)
    {       q=(node *)malloc(sizeof(node));
        q->data=s[i];
        q->next=null;
        p->next=q;
        p=q;
    }   
return(i);