storesimulation.h

来自「数据结构」· C头文件 代码 · 共 48 行

H
48
字号
#ifndef _storeSimulation
#define _storeSimulation

#include"simulation.h"
#include"arriveEvent.h"
#include"orderEvent.h"
#include"leaveEvent.h"

#include<iostream.h>

class storeSimulation:public simulation
{
 public:
	 storeSimulation(int chairNumber);
	 void order(unsigned int numberOfScoops);
	 void printProfits();	
    
 private:
     int freeChairs;
     double profits;
     double num;

	 friend class arriveEvent;
	 friend class leaveEvent;
	 friend class orderEvent;
};


storeSimulation::storeSimulation(int chairNumber):freeChairs(chairNumber),profits(0),simulation()
{
}

void storeSimulation::order(unsigned int numberOfScoops)
{
	num+=numberOfScoops;
}

void storeSimulation::printProfits()
{
	cout<<"一共卖出"<<num<<"支冰淇淋"<<endl;
	cout<<"总利润是"<<(profits=num*2.5)<<"人民币."<<endl;
}

extern storeSimulation store;

#endif

⌨️ 快捷键说明

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