舞伴问题 帮我看看 错在哪里
#include<iostream>#include<stdio.h>
#define MAX_DANCERS 100
#define queuesize 100
typedef struct{
char name[20];
char sex;
}person;
typedef person DataType;
typedef struct{
DataType data[queuesize];
int front;
int rear;
int count;
}cirqueue;
void initial(cirqueue *Q)
{Q->rear =0;
Q->front =0;
Q->count =0;
}
int isempty(cirqueue *Q)
{return Q->count ==0;
}
int isfull(cirqueue *Q)
{return queuesize==Q->count;
}
void enqueue(cirqueue *Q,DataType x)
{if(isfull(Q))
{printf ("duiman");
exit(1);
}
Q->count ++;
Q->data [Q->rear ]=x;
Q->rear =(Q->rear +1)%queuesize;
}
void dequeue(cirqueue *Q)
{DataType temp;
if(isempty(Q))
{printf("duikong");
exit(1);
}
Q->count --;
temp=Q->data [Q->front ];
Q->front =(Q->front +1)%queuesize;
}
DataType Front(cirqueue *Q)
{if(isempty(Q))
{printf("duikog");
exit(1);
}
return Q->data [Q->front ];
}
void dancerparter(person dancer[],int num)
{int i;
person p;
cirqueue mdancer,fdancer;
initial(&mdancer);
initial(&fdancer);
for(i=0;i<num;i++)
{p=dancer[i];
if(p.sex =='f')
enqueue(&fdancer,p);
else
enqueue(&mdancer,p);
}
printf("舞队是:\n \n");
while(!isempty(&mdancer)&&!isempty(&fdancer))
{
p=dequeue(&mdancer);
printf("%s ",p.name );
p=dequeue(&fdancer);
printf("%s ",p.name );
}
if(isempty(&mdancer))
{printf("还有%d个男士等待下一轮\n",fdancer.count );
p=Front(&fdancer);
printf("%s ",p.name );
}
else if(isempty(&fdancer))
{printf("还有%d个女士等待下一轮\n",mdancer.count );
p=Front(&mdancer);
printf("%s ",p.name );
}
}
void initialdancer(person dancer[])
{}
void main()
{person dancer[MAX_DANCERS];
int n=93;
initialdancer(dancer);
dancerparter(dancer,93);
}
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'void' (or there is no acceptable conversion)
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'void' (or there is no acceptable conversion)
执行 cl.exe 时出错.
提示这样的错误
我觉的也没错啊
挺符合逻辑的
谁要是解决这个问题 你要什么我给什么(论坛上的)
[ 本帖最后由 小兔子慢慢 于 2010-3-1 11:56 编辑 ]