카타 8급 Finish Guess the Number Game

C++[ | ]

#include <stdexcept>
class Guesser
{
public:
  Guesser(int number, int lives): number(number), lives(lives)
  { }
  bool guess(int n)
  {
    if( lives <= 0 ) throw std::exception();
    if( number == n ) return true;
    lives--;
    return false;
  }
private:
    int number, lives;
};
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}