这个是我结合大家给我的帮助修改!不过在输出这一环节上还有一些问题!
#include<stdio.h>
#include<malloc.h>
#define maxsize 100
typedef struct node1
{
char data;
struct node1 *next;
}LINKQLIST;
typedef struct
{
LINKQLIST *front,*rear;
}production;//生产
void initlinkqueuep(production *q)//初始化
{
q->front=(LINKQLIST *)malloc(sizeof(LINKQLIST));
(q->front)->next=NULL;
q->rear=q->front;
}
char getlinkfrnetp(production *q)//数据读取
{
char v;
if(q->front==q->rear)
printf("没有生产计划\n");
else
v=(q->front)->next->data;
return v;
}
void enlinkqueuep(production *q,char x)//插入数据
{
(q->rear)->next =(LINKQLIST *)malloc(sizeof(LINKQLIST));
q->rear=(q->rear)->next;
q->rear->data=x;
(q->rear)->next=NULL;
}
void main()
{
production q;
int i,j=0;
char ch[maxsize];
initlinkqueuep(&q);
//enlinkqueuep(&q,'A');
for(i=0;i<maxsize;i++)
{
scanf("%c",&ch[i]);
enlinkqueuep(&q,ch[i]);
if(ch[i]='\n')
break;
}
//printf("%c",getlinkfrnetp(&q));
for(i=0;i<maxsize;i++)
{
printf("%c",getlinkfrnetp(&q));
}