#include "SingleChoiceQuestion.h" SingleChoiceQuestion::SingleChoiceQuestion() { } std::istream& SingleChoiceQuestion::read(std::istream& in, bool) { Question::read(in, false); std::string choice; while ( std::getline( in, choice ) && ! choice.empty() ) choices.push_back(choice); return in; } std::ostream& SingleChoiceQuestion::ask(std::ostream& out) const { Question::ask(out); for ( size_t index = 0; index < choices.size(); ++index ) std::cout << " " << index + 1 << ". " << choices[index] << std::endl; return out; } bool SingleChoiceQuestion::isRightAnswer(const std::string& playerAnswer) const { return std::stoi(playerAnswer) == std::stoi(answer); }