資料結構(使用C語言)佇列,資料結構C語言佇列執行不了

時間 2021-05-05 20:56:30

1樓:

#include "stdio.h"

#include "malloc.h"

#include "stdlib.h"

#include "conio.h"

#define max 80

typedef struct

seque;

seque *init_seque()

int empty_seque(seque *s)int in_seque(seque *s,int x)}int out_seque(seque *s,int *x)}void print_seque(seque *s)}void main()

}while(k!=0);}

2樓:金魚

對順序迴圈佇列,常規的設計方法是使用隊尾指標和隊頭指標,隊尾指標用於指出當前胡隊尾位置下標,隊頭指標用於指示當前隊頭位置下標。現要求:

(1)設計一個使用隊頭指標和計數器胡順序迴圈迴圈佇列抽象資料型別,其中包括:初始化,入佇列,出佇列,取隊頭元素肯判斷佇列是否非空;

#include "stdio.h"

#include "malloc.h"

#include "stdlib.h"

#include "conio.h"

#define max 80

typedef struct

seque;

seque *init_seque()

int empty_seque(seque *s)int in_seque(seque *s,int x) }int out_seque(seque *s,int *x)}void print_seque(seque *s)}void main()

}while(k!=0);}

資料結構c語言佇列執行不了

3樓:油條大巴

//修改的地方主要是將main()裡的 lqueue *lq 改為 lqueue lq ,

//其它函式作出相應的修改.

//1----進佇列

//請輸入要進佇列的資料:100

//4----顯示佇列

//此佇列有資料: 100->

//1----進佇列

//請輸入要進佇列的資料:200

//4----顯示佇列

//此佇列有資料: 100->200->

#include "stdio.h"

#include "malloc.h"

#define maxsize 50 //佇列的最大容量 //maxsize暫時沒有用到

//定義佇列的結構體

typedef int datatype;

typedef struct qnode

linkqueueqnode,*queueptr;

typedef struct

linkqueue,lqueue;

//置空隊

//原**linkqueue * init_lqueue()

void init_lqueue(linkqueue* q)

p->next=null;

q->front=q->rear=p; //帶頭結點的佇列

//原**

/*linkqueue *q;

q->front=q->rear=(linkqueueqnode*)malloc(sizeof(linkqueueqnode));

if(!q->front)

q->front->next=null;*/}

//入隊

int enterqueue(linkqueue* q,datatype e)

p->data=e;

p->next=null;

q->rear->next=p;

q->rear=p;

return 1;

}//出隊

int deletequeue(linkqueue* q,datatype *e)

p=q->front->next;

*e=p->data;

q->front->next=p->next;

if(q->rear==p)

free(p);

return 1;

}//判隊空

int empty_seqstack(linkqueue* q)

else

return 0;

}//顯示佇列

void print(linkqueue* q)

}int main()

else

break;

case 3: //判斷佇列空否

//原**j=empty_seqstack(lq);

j=empty_seqstack(&lq);

if (j==1) printf("此佇列為空!!!");

else printf("此佇列不空。");

break;

case 4: //顯示佇列

//原**print(lq);

j=empty_seqstack(&lq);

if (j==1)

else

}}while(k!=0);

return 0; //int main()要有返回值}

C語言資料結構,C語言 資料結構

include include defineinfinity0 definemax vertex num10 最大頂點數 definemax edge num40 最大邊數typedefenumgraphkind typedefcharvertextype 頂點資料型別typedefstructar...

資料結構c語言描述,資料結構(C語言描述)

include include include define datatype int define maxsize 1000 typedef struct nodebitreenode datatype bt maxsize bitreenode buildbtree datatype bt,in...

c語言中資料結構含義,C語言中資料結構含義

資料的邏輯結構 可以理解為陣列的組成,比如一個結構體有三個int變數組成,這個時候可以認為其邏輯組成是有三個int的變數構成的 資料的儲存結構,可以理解為資料在記憶體中得組織方式,比如說陣列一般是連續儲存,連結串列可能是連續儲存也可能是分佈儲存 資料的運算,簡單說就是對資料的操作,是中行為過程 在資...