WORD格式可编辑 printf(\请输入%d个数用空格隔开:\\n\
 for(i=0;i   p=(SLIST*)malloc(sizeof(SLIST));   scanf(\  wei->next=p;   wei=p;  }   wei->next=tou->next;   //令最后一个原素指向首元结点成环  return tou; }  void outlist(SLIST  *h,int m,int c) {    int i;   SLIST *p,*shanchu;    //用于遍历的指针p,用于删除的指针shanchu  p=h->next;      //p指向首元结点   while(p!=p->next)    //当环中只剩下一个原素时结束  {    for(i=1;i    p=p->next;   }    shanchu=p->next;   //shanchu指向当前要剔除的节点   printf(\   p->next=shanchu->next;  //将shanchu指针指向的节点出环   free(shanchu);   p=p->next;  }   printf(\  //输出最后的一个节点的内容  free(p);        free(h); }  main( )  {  SLIST  *head;  int m,c;        printf(\请分别输入m和c的值:\  scanf(\   head=creatlist(m);    outlist(head,m,c);     }                         专业知识分享                         WORD格式可编辑   四、实验报告要求 1、撰写实验报告;  2、对实验中出现的问题和结果进行总结。                                专业知识分享                         WORD格式可编辑 实验三  栈的实现和应用  一、实验目的   1、掌握栈的建立方法;   2、掌握栈的基本操作,如入栈、出栈、判断空栈等;  3、栈的应用。 二、实验内容  1、顺序栈的初始化 2、判断栈是否为空 3、顺序栈出栈 4、顺序栈入栈  5、栈的应用--汉诺塔 三、实验提示  1、栈的基本操作,按提示将函数补充完整 #include   int data[STACK_MAX]; } stack;  void init(stack *st) /*初始化顺序栈*/ {   st->top=0; }  int Empty(stack *st)/*判断栈是否为空*/ {   if(st->top==0)    return 0;  //空0  else     return 1;  //非空1 }   int pop(stack *st)    /*出栈*/ {   return st->data[--st->top]; }   void push(stack *st,int data)  /*入栈*/ {   st->data[st->top++]=data; }  int main(void)  {                         专业知识分享                         WORD格式可编辑   stack st;   init(&st);   push(&st,5);   push(&st,6);    printf(\ return 0; }    2、#include  void hanoi(int n,char one,char two,char three);     /* 对hanoi函数的声明 */  int m;   printf(\ scanf(\  printf(\ hanoi(m,'A','B','C');  }  void hanoi(int n,char one,char two,char three)     /*  定义hanoi函数,将n个盘从one座借助two座,移到three座 */  {   static k=1;      //定义静态变量k用来标明走了多少步   void move(char x,char y);  //因为move函数定义在该函数的后边且之前咩有声明 在此需要提前声明才能使用   if(n==1)      //当第一个座上仅剩一个盘的时候将此盘移到第三个上   {    printf(\第%d步:\ //输出是第多少步   move(one,three);   //移动  }  else  {    hanoi(n-1,one,three,two); //将前n-1个盘从第一个座移到二个座上,第三个座当桥梁    printf(\第%d步:\    move(one,three);    hanoi(n-1,two,one,three); //将上边转移到第二个座上的盘转移到第三个盘上,第一个盘当桥梁   }                          专业知识分享