⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zidongshouhuoji.h

📁 VC各工程的源码集合
💻 H
字号:
class shouyinji
{
public:
	int cashNow();//返回当前的现金
	void acceptAmount(int acceptcash);//接受付款
	shouyinji(int amount=500);//初始化
private:
	int cash;
};

class shouhuoji
{
public:
	int amount();
	int price();
	void makesale();
	shouhuoji(int numberofproduct=100,
		      int costofproduct=2);//初始化
private:
	int number;
	int cost;
};

int shouyinji::cashNow()
{
	return cash;
}//显示收银机里现有的现金
	
void shouyinji::acceptAmount(int acceptcash)
{
	 cash+=acceptcash;
}

shouyinji::shouyinji(int amount)
{
	if(amount>=0)
		cash=amount;
	else
		cash=100;
}

int shouhuoji::amount()
{
	return number;
}

int shouhuoji::price()
{
	return cost;
}

void shouhuoji::makesale(){
	number--;
}//每售出一件数量减一

shouhuoji::shouhuoji(int numberofproduct,int costofproduct)
{
	if(numberofproduct>0)
		number=numberofproduct;
	else
		number=100;
	if(costofproduct>=0)
		cost=costofproduct;
	else
		cost=2;
}//初始化

	

⌨️ 快捷键说明

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