haircut.cpp

来自「java编程理发馆」· C++ 代码 · 共 30 行

CPP
30
字号
#include<iostream.h>
#include"linklist.h"
#include"queue.h"
#include"simulation.h"
#include"common.h"
void main()
{
	int t;
    cout<<"input the chairs' number:";
	cin>>CurrentChair;
	cout<<"input CloseTime:";
	cin>>CloseTime;
	cout<<endl;
	en.OccurTime=0;
	en.NType=0;
	InitList(ev);
	OrderInsert(ev,en);
	InitQueue(Q);
	while(ev.len!=0)
	{
		DelFirst(ev,en);
		if(en.NType==0) CustomerArrived();
		else CustomerDeparture();
	}
	cout<<"number of customer"<<CustomerNum<<endl;
	cout<<"Average time:"<<Totaltime/CustomerNum<<endl;
	cout<<"Average queuelength"<<Totallength/CustomerNum<<endl;
	t=(t1>=t2)?t1:t2;
	cout<<"Addition time"<<t-CloseTime<<endl;
}

⌨️ 快捷键说明

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