主题:请大哥大姐帮帮小弟看看~~
#include<stdio.h>
#include<iostream.h>
#define max 10
typedef struct
{int queue[max];
int front;
int rear;
}qqtype;
void initiateqq(qqtype *q)
{q->front=-1;
q->rear=-1;}
void enterqq(qqtype *q,int x)
{if(q->rear==max-1)
cout<<"队以满!";
else
{q->rear++;
q->queue[q->rear]=x;
}}
main()
{int ch,sign;
qqtype *q;
initiateqq(q);
printf(">");
while((ch=getchar())!='\n')
//if((sign=enterqq(q,ch))!=1)
// break;
printf("creat queue:\n");
while(q->front!=q->rear)
{q->front++;
printf("%c",q->queue[q->front]);
}
printf("\n");}
小弟看了半天都看不出哪出了问题,郁闷~~~
#include<iostream.h>
#define max 10
typedef struct
{int queue[max];
int front;
int rear;
}qqtype;
void initiateqq(qqtype *q)
{q->front=-1;
q->rear=-1;}
void enterqq(qqtype *q,int x)
{if(q->rear==max-1)
cout<<"队以满!";
else
{q->rear++;
q->queue[q->rear]=x;
}}
main()
{int ch,sign;
qqtype *q;
initiateqq(q);
printf(">");
while((ch=getchar())!='\n')
//if((sign=enterqq(q,ch))!=1)
// break;
printf("creat queue:\n");
while(q->front!=q->rear)
{q->front++;
printf("%c",q->queue[q->front]);
}
printf("\n");}
小弟看了半天都看不出哪出了问题,郁闷~~~