Nineth Week Technical Blog
Chained queues
242 Chen Kunxin Nineth Week. Cpp:defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdio.h"
#include "Stdlib.h"
typedef int DATATYPE;
typedef struct SPACE
{
DataType data;
Space* Next;
}space;
typedef struct QUEUE
{
space* Base;
space* top;
int length;
}queue;
queue* InitQ ()
{
Queue *myq;
myq= (Queue *) malloc (sizeof (queue));
myq->length;
Myq->base= (Space *) malloc (sizeof (space));
myq->base->next=null;
myq->top=myq->base;
return MyQ;
}
void Insq (queue* MyQ, DataType data)
{
Space *temp= (Space *) malloc (sizeof (space));
temp->next=null;
temp->data=data;
myq->top->next=temp;
myq->top->next=myq->top->next->next;
myq->length++;
}
void Remq (queue* myQ)
{
if (myq->length==0)
printf ("The queue is empty");
space* temp=myq->base->next;
myq->base->next=myq->base->next->next;
Free (temp);
myq->length--;
}
void GetTop (queue* myQ)
{
printf ("%d \ n", myq->base->next->data);
}
int main (int argc, char const *argv[])
{
/* Code */
return 0;
}
Week number |
Professional Learning Goals |
Professional Learning Time |
New Code Volume |
Blog post Volume |
Learning in the Humanities |
Knowledge and Skills Summary |
Nineth Week |
Learning the use of chained queues |
4 |
100h |
1 |
No |
The concept of chained tables and queues is not quite understood, and is always a practical failure. |
Nineth Week Technical Blog