虚拟热狗店(骨架)
来源:互联网 发布:excel数据有效性应用 编辑:程序博客网 时间:2024/06/02 11:12
我自己定义了一个热狗店的类,然后就模仿现实开店经营,每天只有一家店开门,后续会放出升级版(升级版会包括:程序会问你是否开分店,你是老板你做主,还有厨师、原料等问题),你问我为什做这个,我回答你闲的。
代码:
#include <iostream>#include <string.h>#include <time.h>#define random(x) (rand()%x)using namespace std;class HotDogStore{private:string name;static int numOFsell;int eachsell;public:HotDogStore(string n);int sell(int num);int output();static int money ;};int HotDogStore::numOFsell = 0;int HotDogStore::money = 0;int HotDogStore::output(){return numOFsell;}int HotDogStore::sell(int num){eachsell = 0;numOFsell += num;eachsell += num;money = money + eachsell * 10;return eachsell;}HotDogStore::HotDogStore(string n){name = n;}int main(){srand((int)time(NULL));HotDogStore s1("store1"), s2("store2"),s3("store3");int number, whitch,month=0;for (; month <= 12; month++){ whitch=random(4); number = random(1000)+10; switch (whitch) { case 1:cout << "Today the store whitch is opening is store1 and today sells hotdog :" << s1.sell(number); cout << endl; break; case 2:cout << "Today the store whitch is opening is store2 and today sells hotdog :" << s2.sell(number); cout << endl; break; case 3:cout << "Today the store whitch is opening is store3 and today sells hotdog :" << s3.sell(number); cout << endl; break; }}cout << "This year you have sold hotdog :" << s1.output() <<" the money that you have got is "<<s1.money<<" $"<<endl;system("pause");return 0;}运行结果:
0 0
- 虚拟热狗店(骨架)
- 圖像細化(骨架化)算法 分析
- 圖像細化(骨架化)算法 分析
- 图像的细化(骨架抽取)
- 好插件(移动骨架)mobilebone.js
- 创建Maven项目(web骨架)
- maven【3】(创建maven骨架archetype)
- maven构建骨架慢(IDEA)
- 动画重定位(相同骨架)
- 儿童网站成虚拟掘金热最新一站
- win10实现屏幕边缘热区切换虚拟桌面
- 基于SDF的抽骨架之散点图(Projected points)
- 透過 OpenNI / NITE 分析人體骨架(上)
- 透過 OpenNI / NITE 分析人體骨架(下)
- 一个完整的makeglossaries例子(仅仅是骨架)
- [Maven实战](5)Archetype生成项目骨架
- flask搭建个人博客(二)——骨架、数据库
- 教自己学Python(五)代码骨架
- ArcGIS Desktop 启动编辑(start editing) "Not Register As Versioned"错误
- 构造无穷个无穷小量,使它们的乘积为常数
- 虚函数,虚析构函数,虚函数表
- 柔性数组
- HDU2224The shortest path(双调旅行商问题)经典
- 虚拟热狗店(骨架)
- Delphi资源
- (源码)自己写的ScrollView里套漂亮的圆角listview(算是漂亮吧。。。)
- ubuntu12.04 安装配置jdk1.7
- 【网络流24题】【cogs738】【codevs1913】数字梯形
- file_put_content
- JSP中的EL
- 虚函数的重载和重新定义
- 用递归实现n^k