event.h

来自「一个模拟沃尔玛柜台结账的排队论仿真」· C头文件 代码 · 共 82 行

H
82
字号
#ifndef EVENT_H
#define EVENT_H

#include <iostream.h>
#include "para.h"

class Event
{
public:
	Event();
	void setStrStp(double t);	
	void setInqStp(double t);
	void setEndStp(double t);
	double getStrStp();
	double getInqStp();
	double getEndStp();
	friend ostream& operator<<(ostream& out, Event& e);

protected:
	int type;
	double strStp;
	double inqStp;
	double endStp;
};

Event::Event():strStp(0),inqStp(0),endStp(0){}

void	Event::setStrStp(double t){strStp=t;}
void	Event::setInqStp(double t){inqStp=t;}
void	Event::setEndStp(double t){endStp=t;}
double	Event::getStrStp(){return strStp;}
double	Event::getInqStp(){return inqStp;}
double	Event::getEndStp(){return endStp;}

ostream& operator<<(ostream& out, Event& e)
{
	out<<"strStp: "<<e.getStrStp()<<"|"
		<<"endStp: "<<e.getEndStp()<<"|";
	return out;
}


///////////////////////////////////////////////////////////////////
class Mess
{
public:
	Mess(int tp,double tm);
	int getType();
	double getTim();
	int operator < (Mess& m);
	friend	ostream& operator<< (ostream& out,Mess& m);

private:
	int type;
	double tim;
};

Mess::Mess(int tp,double tm)
{
	type=tp;
	tim=tm;
}

int		Mess::getType(){return type;}

double	Mess::getTim(){return tim;}

int		Mess::operator < (Mess& m)
{
	if(tim<m.getTim())
		return 1;
	else
		return -1;
}

ostream& operator<< (ostream& out,Mess& m)
{
	out<<"Type: "<<m.getType()<<"  "<<"Time: "<<m.getTim();
	return out;
}

#endif

⌨️ 快捷键说明

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