您的位置:首页 > 其它

第七周项目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


运行结果:

知识点总结:

学习心得:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: