您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CreateQueue函数代码示例

51自学网 2021-06-01 20:15:03
  C++
这篇教程C++ CreateQueue函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CreateQueue函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateQueue函数的具体用法?C++ CreateQueue怎么用?C++ CreateQueue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CreateQueue函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(){	Queue TestQueue = CreateQueue(10);	cout << "Begin test of queue " << endl;	for (int i = 0, n = 1; i < 10; i++, n *= 2)	{		cout << i + 1 << "> Enqueue : " << n<<endl;		Enqueue(n, TestQueue);	}	PrintQueue(TestQueue);	cout << "Is Full ? " << IsFull(TestQueue)<<endl;	for (int i = 0; i < 5; i++)	{		cout << i + 1 << " >Dequeue :" << Front(TestQueue) << endl;		Dequeue(TestQueue);	}	PrintQueue(TestQueue);	cout << "Front and dequeue: " << FrontAndDequeue(TestQueue)<<endl;	cout << "Now add more data to test the cicular array..." << endl;	for (int i = 0; i < 5; i++)	{		cout << i + 1 << "> Enqueue : " << i << endl;		Enqueue(i, TestQueue);	}	PrintQueue(TestQueue);	cout << "Now make the queue empty...";	MakeEmpty(TestQueue);	cout << "Is Empty ? "<<IsEmpty(TestQueue)<<endl;	cout << "Now dipose the queue!" << endl;	DisposeQueue(TestQueue);	cout << "Test Succeed!" << endl << "Good bye!"<<endl;	getchar();}
开发者ID:oceanjaya,项目名称:DataStructurePractice,代码行数:34,


示例2: BFSTraversal

int BFSTraversal(GNode* graphRoot,int u,int v){QNode* queue=CreateQueue(graphRoot->count);EnQueue(queue,u);int data;ALNode* tmpNode;while(!IsEmptyQueue(queue)){data=DeQueue(queue);if(visited[data]==0){//printf("%d  ",data);tmpNode=graphRoot->GArray[data]->head;while(tmpNode){    if(tmpNode->destination==v){    return 1;    }if(visited[tmpNode->destination]==0){EnQueue(queue,tmpNode->destination);}tmpNode=tmpNode->next;}visited[data]=1;}}return 0;}
开发者ID:sidpka,项目名称:repo,代码行数:31,


示例3: main

int main(){	FILE *ptr;	ptr=fopen("file.txt","r");	CheckFileForError(ptr);	  CreateQueue();  char str[80];  int i, pnum, atime,btime; 	while(fgets(str,80,ptr)!=NULL) 	{    int *point;    point = FindNuminString(str,0);    pnum = *point;    point = FindNuminString(str,*(point+1));    atime = *point;    point = FindNuminString(str,*(point+1));    btime = *point;      EnQueue(pnum,atime,btime);  }  int time_quantum;  printf("/n Enter the time quantum: ");  scanf("%d",&time_quantum);  CalculateRR(time_quantum);	fclose(ptr);	DeleteQueue();	return 0;}
开发者ID:batraman,项目名称:sandbox,代码行数:33,


示例4: findBottomLeftValue

int findBottomLeftValue(TreeNode* root) {    Trique*q=zCreateQueue(1000);;    Queue*level=CreateQueue(1000);    zEnqueue(q,root);    Enqueue(level,0);    int m=0;    while(q->NumElements){        TreeNode *r = zFront(q);         zDequeue(q);        int l = Front(level);         Dequeue(level);        if(r->left) {            zEnqueue(q,r->left);            Enqueue(level,l+1);        }        if(r->right){            zEnqueue(q,r->right);            Enqueue(level,l+1);        }        if(l > m){            m = l;            root = r;        }    }    return root->val;}
开发者ID:pocketzeroes,项目名称:proekt,代码行数:26,


示例5: Bfs

void Bfs(int graph[][maxVertices], int *size, int presentVertex,int *visited){        visited[presentVertex] = 1;        /* Iterate through all the vertices connected to the presentVertex and perform bfs on those           vertices if they are not visited before */        Queue *Q = CreateQueue(maxVertices);        Enqueue(Q,presentVertex);        while(Q->size)        {                presentVertex = Front(Q);                printf("Now visiting vertex %d/n",presentVertex);                Dequeue(Q);                int iter;                for(iter=0;iter<size[presentVertex];iter++)                {                        if(!visited[graph[presentVertex][iter]])                        {                                visited[graph[presentVertex][iter]] = 1;                                Enqueue(Q,graph[presentVertex][iter]);                        }                }        }        return;        }
开发者ID:gaurav594,项目名称:programs,代码行数:26,


示例6: LevelOrderTraversal

void LevelOrderTraversal(struct TNode* root,int n){if(!root){return;}QNode* queue=CreateQueue(n);EnQueue(queue,root);struct TNode* tmpNode;while(!IsEmptyQueue(queue)){tmpNode=DeQueue(queue);if(tmpNode){printf("%d   ",tmpNode->data);}if(tmpNode->left){EnQueue(queue,tmpNode->left);}if(tmpNode->right){EnQueue(queue,tmpNode->right);}}}
开发者ID:sidpka,项目名称:repo,代码行数:30,


示例7: bfs_iterative

void bfs_iterative(LGraph graph, Vertex start, void (*func)(nodeptr p)){    int visited[graph->vertex_num];    Queue queue = CreateQueue(graph->vertex_num);    nodeptr curr;    curr = graph->G[start];    visited[curr->adjv] = 1;    enqueue(queue, curr);        while (!QIsEmpty(queue))    {                while (curr)        {            if (visited[curr->adjv] != 1)            {                enqueue(queue, curr);                visited[curr->adjv] = 1;            }                            else                curr = curr->next;        }        nodeptr temp = dequeue(queue);        curr = graph->G[temp->adjv];        (*func)(curr);    }}
开发者ID:spencerpomme,项目名称:coconuts-on-fire,代码行数:27,


示例8: CheckIfCompleteBinaryTree

int CheckIfCompleteBinaryTree(struct TNode* root,int n){QNode* queue=CreateQueue(n);struct TNode* tmpNode;EnQueue(queue,root);int result;while(!IsEmptyQueue(queue)){tmpNode=DeQueue(queue);if(IsFullNode(tmpNode)){    EnQueue(queue,tmpNode->left);    EnQueue(queue,tmpNode->right);}else if(tmpNode->right){result=0;break;}else if(tmpNode->left){continue;}else{while(IsLeafNode(tmpNode) && !IsEmptyQueue(queue)){tmpNode=DeQueue(queue);}if(IsEmptyQueue(queue)){result=1;break;}else{result=0;break;}}}return result;}
开发者ID:sidpka,项目名称:repo,代码行数:34,


示例9: main

int main(int argc, char *argv[]){	int a,cevap;	struct Queue *q;	printf("Siradaki eleman sayisi:");	QueueSize(q);	if(isEmpty(q)==0){		printf("Kuyruk bos!");	}	if(isFull(q)==0){		printf("Kuyruk dolu!");	}	switch(cevap){	case 1: printf("1)bos kuyruk yaratmak icin:");	break;	case 2: printf("2)Kuyruga kisi eklemek icin");	break;	case 3: printf("3)Kuyruktan kisi silmek icin ");	break;	default: printf("Hata! 1 2 ya da 3 e basiniz.");	break;	}	if(cevap==1) CreateQueue(q);	if(cevap==2) Enqueue(q);	if(cevap==3) Dequeue(q,a);}
开发者ID:denizsecgin,项目名称:c-projelerim,代码行数:30,


示例10: ConditionConstructor

//Limit of the queue, and the id of this condition variable{NOT_FULL,NOT_EMPTY}ConditionPtr ConditionConstructor(int limit, int ID){	ConditionPtr condition = (ConditionPtr) malloc(sizeof(ConditionStr));	condition->queue = (Queue)CreateQueue(limit);	condition->id = ID;		return condition;}
开发者ID:pasangsherpa,项目名称:scheduler,代码行数:8,


示例11: Queue_is_Empty

void Queue_is_Empty(){    Queue Q;    Q = CreateQueue();    assert(IsEmpty(Q) == true);     DisposeQueue(Q);}
开发者ID:junhuawa,项目名称:DataStructure,代码行数:7,


示例12: setup_usart

/* Initialize the USART6. */void setup_usart(void) {	USART_InitTypeDef USART_InitStructure;	GPIO_InitTypeDef GPIO_InitStructure;	/* Enable the GPIOC peripheral clock. */	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);	/* Make PC6, PC7 as alternative function of USART6. */	GPIO_PinAFConfig(GPIOC, GPIO_PinSource6, GPIO_AF_USART6);	GPIO_PinAFConfig(GPIOC, GPIO_PinSource7, GPIO_AF_USART6);	/* Initialize PC6, PC7.  */	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;	GPIO_Init(GPIOC, &GPIO_InitStructure);	/* Enable the USART6 peripheral clock. */	RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);	/* Initialize USART6 with	 * 115200 buad rate,	 * 8 data bits,	 * 1 stop bit,	 * no parity check,	 * none flow control.	 */	USART_InitStructure.USART_BaudRate = 115200;	USART_InitStructure.USART_WordLength = USART_WordLength_8b;	USART_InitStructure.USART_StopBits = USART_StopBits_1;	USART_InitStructure.USART_Parity = USART_Parity_No;	USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;	USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;	USART_Init(USART6, &USART_InitStructure);	/* Enable USART6. */	USART_Cmd(USART6, ENABLE);	/* Initial the USART TX streams. */	for(usart_stream_idx = MAX_USART_STREAM;		usart_stream_idx > 0;		usart_stream_idx--)		ClearStream(usart_stream + usart_stream_idx - 1);	/* Initial the RX Queue. */	rxQueue = &__rxQueue;	CreateQueue(rxQueue, __rxBuf, RX_QUEUELEN, sizeof(uint8_t));	if(rxQueue != NULL)		USART_Printf(USART2, "RX pipe created./r/n");	else		USART_Printf(USART2, "RX pipe created failed./r/n");	/* Disable RX pipe first. */	USART_DisableRxPipe(USART6);	/* Enable USART6 RX interrupt. */	USART_ITConfig(USART6, USART_IT_RXNE, ENABLE);	/* Enable USART6 in NVIC vector. */	NVIC_EnableIRQ(USART6_IRQn);}
开发者ID:biddyweb,项目名称:MicroHttpServer,代码行数:61,


示例13: main

int main(){    CreateQueue();    CreateMGraph();    ListComponents();    return 0;}
开发者ID:yanxutao,项目名称:DataStructure,代码行数:7,


示例14: main

//-----------------------------------------------// Test a 4-entry queue//-----------------------------------------------int main(){  int elem = 0;  queue *Q;  CreateQueue(Q, 4);    Dequeue(Q);  Enqueue(Q, ++elem);  Enqueue(Q, ++elem);  Enqueue(Q, ++elem);  Enqueue(Q, ++elem);  Dequeue(Q);  Enqueue(Q, ++elem);  Enqueue(Q, ++elem);  Dequeue(Q);  Enqueue(Q, ++elem);  Dequeue(Q);  Enqueue(Q, ++elem);  Dequeue(Q);  Dequeue(Q);  Dequeue(Q);  Dequeue(Q);  DestroyQueue(Q);  return 0;}
开发者ID:jinz2014,项目名称:FP_HLS,代码行数:30,


示例15: TEST_F

TEST_F(TQueueTest,  can_detect_when_queue_is_full){  CreateQueue(3);  SetUpFullQueue();  ASSERT_TRUE(queue->IsFull());}
开发者ID:ZhbanovaAnna,项目名称:exa-min-light,代码行数:7,


示例16: printReverseLevelOrder

void printReverseLevelOrder(tree_node *root){	Stack *st = CreateStack();	Queue *q = CreateQueue();	enqueue(q, root);	enqueue(q, NULL);	while(!isEmpty(q)){		tree_node *tmp = dequeue(q);		if(tmp == NULL){			//level changed			if(!isEmpty(q)){				enqueue(q, NULL);			}		} else {			push(st, tmp);			if(tmp->left != NULL)							enqueue(q, tmp->left);			if(tmp->right != NULL)							enqueue(q, tmp->right);		}	}	while(!isEmptyStack(st)){		printf("%d /t", pop(st)->data);	}	printf("/n");	free(q);	free(st);}
开发者ID:satish2,项目名称:Learn,代码行数:27,


示例17: main

int main(){    int msqid;    key_t key;    struct mymsgbuf mybufin;    key = GenerateKey();    msqid = CreateQueue();    semid = CreateSemaphore();    while (1)    {        if ((msgrcv(msqid, (struct msgbuf *)&mybufin, sizeof(struct dish),2 , 0)) < 0)        {            printf("Can/'t receive message from queue/n");            exit(-1);        }        printf("Dish is wiping: size %d, amount of water %d/n", mybufin.cleanDish.size, mybufin.cleanDish.amountOfWater );        sleep( mybufin.cleanDish.size + mybufin.cleanDish.amountOfWater );        printf("Dish was wiped/n");        ChangeSemaphore(semid, mybufin.cleanDish.size);    }    return 0;}
开发者ID:FilippNikitin,项目名称:3sem,代码行数:25,


示例18: main

int main(){	FILE *ptr;	ptr=fopen("file.txt","r");	CheckFileForError(ptr);	  CreateQueue();  char str[80];  int i, pnum, atime,btime; 	while(fgets(str,80,ptr)!=NULL) 	{    int *point;    point = FindNuminString(str,0);    pnum = *point;    point = FindNuminString(str,*(point+1));    atime = *point;    point = FindNuminString(str,*(point+1));    btime = *point;      EnQueue(pnum,atime,btime);  }    CalculatePSJF();	fclose(ptr);	DeleteQueue();	return 0;}
开发者ID:batraman,项目名称:sandbox,代码行数:31,


示例19: main

int main(){	struct ArrayQueue *Q = CreateQueue();	//printf("%d /n",Dequeue(Q));	Enqueue(Q,1);	Enqueue(Q,2);	Enqueue(Q,3);	Enqueue(Q,4);	printf("%d /n",Dequeue(Q));	printf("%d /n",Dequeue(Q));	Enqueue(Q,5);	Enqueue(Q,6);	printf("%d /n",Dequeue(Q));	printf("%d /n",Dequeue(Q));	Enqueue(Q,7);	Enqueue(Q,8);	Enqueue(Q,9);	Enqueue(Q,10);	Enqueue(Q,20);	Enqueue(Q,30);	Enqueue(Q,40);	for(int i=0;i<10;i++){		printf("A %d /n",Q->array[i]);	}		}
开发者ID:Tanuja-Sawant,项目名称:Colour,代码行数:31,


示例20: InitPathFinder

void InitPathFinder(PathFinder* pathFinder, Map* map, bool diagonal){    pathFinder->map = map;    pathFinder->openList = CreateQueue(nodeMinCompare, map->width * map->height);    // Clear our internal map    pathFinder->nodeMap = malloc(sizeof(Node*) * map->width);    for (int i = 0; i < map->width; ++i)    {        pathFinder->nodeMap[i] = malloc(sizeof(Node) * map->height);        memset(pathFinder->nodeMap[i], 0, sizeof(Node) * map->height);    }    for (int i = 0; i < map->width; i++)    {        for (int e = 0; e < map->height; e++)        {            pathFinder->nodeMap[i][e].x = i;            pathFinder->nodeMap[i][e].y = e;            pathFinder->nodeMap[i][e].open = NoList;        }    }    //pathFinder->path = malloc(sizeof(PathNode) * map->height * map->width);    //pathFinder->pathSize = 0;    pathFinder->path = NULL;    pathFinder->allowDiagonal = diagonal;}
开发者ID:sanford1,项目名称:Astar,代码行数:28,


示例21: main

int main(void) {/*	int *temp = (int*)malloc(4*sizeof(int));	int i =1;	printf("%d  %d",temp,temp+i);*/	int i=0;	int data;	Queue testqueue = CreateQueue(5);	for(i=0;i<100;i++)	{		Enqueue(i,testqueue);	}	for(i=0;i<50;i++)	{		data = Dequeue(testqueue);		printf("%d  ",data);	}	for(i=100;i<200;i++)    {		Enqueue(i,testqueue);	}	for(i=0;i<150;i++)		{			data = Dequeue(testqueue);			printf("%d  ",data);		}	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */	return EXIT_SUCCESS;}
开发者ID:gongsm,项目名称:Eclipse_test,代码行数:29,


示例22: main

int main( ){    Queue Q;    int i;    Q = CreateQueue( 12 );    FAIL_ON_NULL(Q->data)        i=0;    for( i = 0; i < 10; i++ )        Enqueue( i, Q );    while( !IsEmpty( Q ) )    {        printf( "%d/n", Front( Q ) );        Dequeue( Q );    }    for( i = 0; i < 20; i++ )        Enqueue( i, Q );    while( !IsEmpty( Q ) )    {        printf( "%d/n", Front( Q ) );        Dequeue( Q );    }    DisposeQueue( Q );    return 0;}
开发者ID:strongliang,项目名称:C-study,代码行数:30,


示例23: main

int main(){  int value, i;  int n =10;  QueType* q1 = NULL;  QueType* q2 = NULL;  //QueType* q3 = NULL; QueType* q4 = NULL;  QueType* queue;  //queue = CreateQueue();  int count = 0;      queue = CreateQueue();      printf ( "/n Enter elements in the queue : ") ;      scanf("%d/n",&value);  //     for(i=0;i<=10;i++){        while(value != -9999){        Enqueue(queue,value);        scanf("%d/n", &value);        value++;}        if(i=1;i<10;i++){        Enqueue(q1,value);       printf("%d element in the q1", value);       scanf("%d/n", &value);        }        else
开发者ID:shrutichapadia,项目名称:npu,代码行数:27,


示例24: printf

/** * Creates the queue of AutoCommand instances */void AutonomousController::StartAutonomous() {	printf("Starting auto /n");	CreateQueue();	currentCommand = firstCommand;	if (currentCommand != NULL) {		currentCommand->Init();	}}
开发者ID:team1868,项目名称:SCcode2015,代码行数:11,


示例25: main

int main(){    struct Queue *q = CreateQueue();    Insert(q,1,1);    Insert(q,2,6);    Insert(q,6,2);    printf("%d/n",Delete(q)->element);    return 0;}
开发者ID:SudeshnaBora,项目名称:DataStructures,代码行数:9,



注:本文中的CreateQueue函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CreateRemoteThread函数代码示例
C++ CreateProperty函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。