📄 candymachineimp.cpp
字号:
//Implementation file candyMachineImp.cpp
//This file contains the definitions of the functions to
//implement the operations of the classes cashRegister and
//dispenserType
#include <iostream>
#include "candyMachine.h"
using namespace std;
int cashRegister::getCurrentBalance() const
{
return cashOnHand;
}
void cashRegister::acceptAmount(int amountIn)
{
cashOnHand = cashOnHand + amountIn;
}
cashRegister::cashRegister(int cashIn)
{
if (cashIn >= 0)
cashOnHand = cashIn;
else
cashOnHand = 500;
}
int dispenserType::getNoOfItems() const
{
return numberOfItems;
}
int dispenserType::getCost() const
{
return cost;
}
void dispenserType::makeSale()
{
numberOfItems--;
}
dispenserType::dispenserType(int setNoOfItems, int setCost)
{
if (setNoOfItems >= 0)
numberOfItems = setNoOfItems;
else
numberOfItems = 50;
if (setCost >= 0)
cost = setCost;
else
cost = 50;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -