#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.length() > 0 ) choices.push_back(choice); return in; } std::ostream& SingleChoiceQuestion::print(std::ostream& out) const { Question::print(out); for ( size_t index = 0; index < choices.size(); ++index ) out << '\t' << index + 1 << ". " << choices[index] << std::endl; return out; } long SingleChoiceQuestion::ask() { print(std::cout); std::cout << "Your answer: "; long playerAnswer = 0; if ( ! (std::cin >> playerAnswer) ) return -1; return playerAnswer == std::stol(answer); }