- 1
- 0
- 约6.27千字
- 约 14页
- 2022-05-06 发布于四川
- 举报
电3科技人学信息与通信工程学浣标准实验报告
(实验)课程名称软件技术基础
电子科技大学教务处制表
3、源程序(带注释)
1)循环队列基本操作:
#includestdio. h#includcstdlib. h
#define true 1iidefine false 0
#define maxnum 4 typedef struct {
int data[maxnum+l];
int front, rear;} queuetype; int main () (
void Initiate (queuetype * p);//声明初始化函数 int Enter (queuetype * p, int x);〃声明入队函数 int Leave (queuetype * p);〃声明出队函数 void Print (queuetype * p) ;//声明打印函数 queuetype* A;
A = (queuetype*)malloc (sizeof (queuetype));〃对 A 分配空间 if (!A)exit(0);〃如果分配空间失败,退出程序
Initiate(A);〃初始化 A
for (int i=0; i 3; i++)〃通过循环将1, 2, 3依次入队 (
if (!Enter (A, i + 1)) (
printf (/zthe push failied !
原创力文档

文档评论(0)