01.02

01.02_第1张图片

#include 

using namespace std;
int blood=10000;
class hero{
protected:
    string name;
    int hp;
    int attack;
public:
    hero(){}
    hero(string name,int hp,int attack):name(name),hp(hp),attack(attack){}
    virtual void Atk(){blood-=0;}
};
class mage:public hero{
  int ap_atk=50;
public:
  mage():hero(){}
  mage(string name,int hp,int attack):hero(name,hp,attack){}
  virtual void Atk(){blood-=attack+ap_atk;}

};
class adc:public hero{
  int ac_atk=100;
public:
  adc():hero(){}
  adc(string name,int hp,int attack):hero(name,hp,attack){}
  virtual void Atk(){blood-=(attack+ac_atk);}
};
int main()
{
    while(blood>0){
            mage b("妖姬",4000,78);
            b.Atk();
            cout<<"妖姬砍了一刀,造成50伤害,boss剩余blood="<

01.02_第2张图片

你可能感兴趣的:(作业,程序人生)