标题:那位大虾帮我看看这个队列的函数啊(要求队列初始化 入队列 出队列的操作)
取消只看楼主
123605585
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-11-14
 问题点数:0 回复次数:0 
那位大虾帮我看看这个队列的函数啊(要求队列初始化 入队列 出队列的操作)

救救啊 就是哪个IN函数除了问题了

本人QQ:123605585 不胜感激。。。

#define LEN sizeof(struct sb) #define NULL 0 #include<stdio.h> struct sb {char ch; struct sb *next; }; struct sb *base,*top,*p;

void creat() /*chushihua*/ {char str[100]; int i=0; printf("\nIMPUT:"); scanf("%s",str); top=base=p=(struct sb *)malloc(LEN); top->ch=str[i]; top->next=NULL; i++; while(str[i]!=NULL) {top=(struct sb *)malloc(LEN); top->ch=str[i]; p->next=top; top->next=NULL; p=top; i++; } } void in() {char la; printf("\nIMput:"); la=getchar(); top=(struct sb *)malloc(LEN); top->ch=la; p->next=top; p=top; top->next=NULL; printf("\nIN successfully!\n"); } out() {base=base->next; printf("OUT SUCCESSFULLY"); } void print() {struct sb *b; b=base; if(base==NULL) printf("NONE OF CHARS!\n"); else printf("\nTHOSE DATA ARE:"); while(b->next!=NULL) { printf("%3c",b->ch); b=b->next; } printf("%3c",b->ch); }

void choose() { printf("\n1:in.\n2:out.\n3:print.\n4:exit.\n"); } main() { char mm; int xuan; creat(); do {choose(); scanf("%d",&xuan);

switch(xuan) {case 1:in();break;

case 2: out();break; case 3: print();break; defult: break; } }while(xuan<4);

}



搜索更多相关主题的帖子: 队列 函数 
2004-11-14 11:06



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




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

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