题目内容
(请给出正确答案)
[主观题]
编写函数,计算成绩序列元素的平均值。实现:给定一个成绩序列,返回成绩平均值,并调用函数输出返回值。
答案
在链式队列中删除元素即为用链式队列的存储结构进行出队操作。 LinkQueue DeQueue(LinkQueue QQueueElementType*e) { QueueNode*P; if(QueueEmpty(Q)) printf(“队列为空出队操作失败!\n”); else{ p=Q.front->next; *e=p->data Q.front->next=p->next; if(Q.rear==p) Q.rear=Q.front; free(P); } return Q;} 在链式队列中删除元素,即为用链式队列的存储结构进行出队操作。LinkQueueDeQueue(LinkQueueQ,QueueElementType*e){QueueNode*P;if(QueueEmpty(Q))printf(“队列为空,出队操作失败!\n”);else{p=Q.front->next;*e=p->dataQ.front->next=p->next;if(Q.rear==p)Q.rear=Q.front;free(P);}returnQ;}
![](https://lstatic.shangxueba.com/sxbcn/h5/images/tips_org.png)