📄 serverfun.cpp
字号:
#include"servertype.h"
#include<iomanip>
#include<iostream>
using namespace std;
SErverType::SErverType()
{
strcpy(status,"free");
transactiontime=0;
}
bool SErverType::ServerIsFree()
{
if(!strcmp(status,"free"))return true;
else return false;
}
bool SErverType::ServerIsBusy()
{
if(strcmp(status,"busy")==0)return true;
else return false;
}
void SErverType::SetFree()
{
strcpy(status,"free");
}
void SErverType::SetBusy()
{
strcpy(status,"busy");
}
void SErverType::DecreaseTransactionTime()//客户一离开,应该输出离开信息
{
transactiontime=transactiontime-1;
if(transactiontime==0)
{
SetFree();
currentcustomer.DepartureDisplay();
}
}
void SErverType::GetCustomer(CUstomerType cust)//客户一来到服务器,应该输出开始服务的信息
{
if(strcmp(status,"free")==0)
{
currentcustomer=cust;
transactiontime=currentcustomer.GetTransactionTime();
SetBusy();
currentcustomer.StartServerDisplay();
}
else
return;
}
int SErverType::GetTraTime()
{
return transactiontime;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -