第七周项目4:用多文件组织多个类的程序(1)
2016-04-13 17:38
381 查看
问题及代码:
运行结果:
知识点总结:
学习心得:
#ifndef WEA_H_INCLUDED #define WEA_H_INCLUDED #include"wea.h" #include<string.h> #include<iostream> using namespace std; class weapon { public: weapon(string nam,int f); int showweapon(); void show(); private: int force; string wname; }; class role { public: role(string ch,int x,string nam,int f); void show(); int attack(role &r); int eat(int n); int beattack(); bool islived(); private: string name; int blood; bool life; weapon wea; }; #endif // WEA_H_INCLUDED
运行结果:
知识点总结:
学习心得:
相关文章推荐
- 团队计划backlog
- NSBundle
- HDU 5228 ZCC loves straight flush 暴力
- Linux Shell脚本教程
- jquery格式化时间
- 二叉树中和为某一值的路径
- 要看的文章(不定期更新)
- U盘安装Windows 10和Ubuntu Linux双系统图解教程
- POJ 2019(二维RMQ)
- getLastKnownLocation 返回null
- stopPropagation, preventDefault 和 return false 的区别
- CardVIew 卡片式布局
- hive中的一些基本问题解决方法
- iOS 警告收录及科学快速的消除方法
- 一款基于HTML5的Web 3D开发工具
- Socket通讯
- HBase Rowkey的散列与预分区设计
- HDU 1281 棋盘游戏(二分图匹配)
- [bzoj2555]substring 解题报告
- Oracle 死锁的检测查询及处理