救救啊 就是哪个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);
}