waitingqueue.h

来自「模拟银行(也可以其他类似)一天的营运光顾情况。」· C头文件 代码 · 共 35 行

H
35
字号
#include<iostream>
using namespace std;
class WaitingCustomerQueue:public QUeue<CUstomerType>
{
protected:
	int lefttottime;
public:
	void UpdateWatingQueue();//每隔一个单位时间,队伍中等待的顾客的waitingtime就加1
	int LeftTotWaitingTime();
};

void WaitingCustomerQueue::UpdateWatingQueue()
{
    QueueLen();
	int i,count;
	for(count=0,i=front+1;count<len;i++,count++)
	{
		if(i==MAXSIZE)i=i-MAXSIZE;
		room[i].IncrementWaitingTime();
	}
}


int WaitingCustomerQueue::LeftTotWaitingTime()
{
	int i,count;
	QueueLen();
	lefttottime=0;
	for(count=0,i=front+1;count<len;i++,count++)
	{
		if(i==MAXSIZE)i=i-MAXSIZE;
		lefttottime+=room[i].GetWaitingTime();
	}
	return lefttottime;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?