Last active
March 13, 2018 07:19
-
-
Save ohmiyaji/0bc917f687fcec2bc824a83d17a66cf7 to your computer and use it in GitHub Desktop.
gameclass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Game{ | |
Mao m; | |
Hero h; | |
void Ending()const; | |
public: | |
Game(); | |
void Play(); | |
}; | |
Game::Game(){ | |
cout << "これから魔王と戦います。がんばれ!" << endl; | |
cout << "魔王の残りエネルギー:" << m.GetEnergy(); | |
} | |
void Game::Ending()const{ | |
cout << "さあ、ゲームはおしまいです。" << endl; | |
} | |
void Game::Play(){ | |
while(h.GetEnergy()>0){ | |
if(m.GetEnergy()<=0){ | |
break; | |
} | |
m.Attaked(h.Attack()); | |
} | |
if(m.GetEnergy()>0){ | |
cout << "・・・魔王は逃げてしまった。" << endl; | |
} | |
Ending(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment