📄 class.cpp
字号:
#include<iostream>
#include"fstream"
#include"class_declaration.h"
bool Product::set_menu()
{
cout<<"退出请按 0 ,继续请按 1 : ";
string n;
cin>>n;
while(n!="0")
{
cout<<endl;
if(n=="1")
{
cout<<"商品名称:";
cin>>name;
if(!cin)
return false;
cout<<"商品体积:";
cin>>cubage;
if(!cin)
return false;
cout<<"商品价格:";
cin>>price;
if(!cin)
return false;
cout<<"商号数量:";
cin>>amount;
if(!cin)
return false;
if(amount>15)
{ cout<<"输入的数量超过最大量!"<<endl;
//cout<<"建议不要保存菜单!"<<endl;
return false;
}
cout<<endl;
return true;}
else
{
cout<<"输入错误,请重新输入: ";
cin>>n;
cout<<endl;
}
}
return false;
}
void Product::set_amount(int a)
{
amount=a;
}
void Product::set_menu2(string n,int c,double p)
{
name=n;
cubage=c;
price=p;
}
string Product::get_name()const
{
return name;
}
int Product::get_cubage()const
{
return cubage;
}
double Product::get_price()const
{
return price;
}
int Product::get_amount()const
{
return amount;
}
void Coin::add_value()
{
value+=coin_value;
}
void Coin::set_coin_value()
{
cin>>coin_value;
}
double Coin::get_coin_value()const
{
return coin_value;
}
double Coin::get_value()const
{
return value;
}
double Coin::value=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -