谁能帮我编辑一个C语言程序??
来源:百度知道 编辑:UC知道 时间:2024/05/27 10:18:48
3Q~~
8月30日 10:22 #include <stdio.h>
#include <string.h>
#define LEN_SHANG sizeof(struct node_shang)
#define LEN_YUSHU sizeof(struct node_yushu)
struct node_shang {/*商结点*/
char data;
struct node_shang *next;
} *shang_head=0, *shang_tail=0;
struct node_yushu {/*余数结点*/
long data;
struct node_yushu *next;
} *yushu_head=0, *yushu_tail=0;
int shang_empty(void) {/*判断商串是否空*/
return shang_head==0;
}
int yushu_empty(void) {/*判断余数串是否空*/
return yushu_head==0;
}
struct node_shang *new_shang_node(char ch) {/*新建商的结点*/
struct node_shang *ptr= (struct node_shang *) malloc(LEN_SHANG);
ptr->data=ch;
ptr->next=0;
return ptr;
}
struct node_yushu *new_yushu_node(long a) {/*新建余数结点*/
struct node_yushu *ptr= (struct node_yushu *) malloc(LEN_YUSHU);
ptr->data= a;
ptr->next=0;
return ptr;
}
void insert_shang(char ch) {/*插入商字符