C++ - Queue Management part 1

本文介绍如何在C++中实现一个队列管理系统。队列类包含大小属性和一个用于存储客户ID(整数)的数组。队列提供移除队首元素的remove()方法、打印队列内容的print()方法,以及在队尾添加元素的add()方法。
摘要由CSDN通过智能技术生成

Queue Management

You are working on a Queue management system and need to create the class to hold the queue data, which are customer IDs (integers).
You make a Queue class, which has a size attribute, and an array, to hold the data of the queue.
The class has a remove() method to remove the front item of the queue, a print() method to output the queue.

You need to create an add() method for the Queue class, that will take an item and add it to the end of the queue.
The code needs to be fully working, so that the Queue declaration and manipulation code in main() works.

Solution

void Add(int newinfo){
   
	if (size != 0 || size != 100){
   
		size++;
		queue[size-1] = newinfo;
	}
}

Given Code:

#include <iostream
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值