#include<stdio.h>
#include<stdlib.h>

//#define OK 1
//#define ERROR 0

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

typedef char ElemType;
//typedef int status;

// 创建结构体
typedef struct node
{
ElemType data;
struct node *prior;
struct node *next;

}Node,*List;

//建立空表 并建表
int InitList(List *L)
{
Node *p,*q;
int i ;
*L=(List)malloc(sizeof(Node));
if(!(*L))
{
return 0;
}
(*L)->next=(*L)->prior=NULL;
p=(*L);

for(i=0;i<26;i++)
{
q=(Node *)malloc(sizeof(Node));
if(!q)
{
return 0;
}
q->data='A'+i;
q->prior=p;
q->next=p->next;
p->next=q;
p=q;

}
p->next=(*L)->next;
(*L)->next->prior=p;
return 1;
}

void paixu(List *L,int i)
{
Node *p=(*L)->next;
if(i>0)
{
do
{
(*L)=(*L)->next;
}while(--i);
}
if(i<0)
{
while(i==0)
{
p=p->prior;
++i
}
(*L)=p;
}
}

int main()
{
List L;
int i ;
InitList(&L);
printf("请输入一个整数:");
scanf("%d",&i);
printf("\n");
paixu(&L,i);

for(i=0;i<26;i++)
{
L=L->next;
printf("%c",L->data);
}

return 0;
}

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄