We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include "h09.h" #include BOOST_MODULE(array) std::string STUDENT = ""; #define FUNC (const std::string& msg) { prssPrmt(msg); void prssPrmt(const std::string& msg) { std::cout << msg; if (!msg.empty() && msg.at(msg.size() - 1) != ' ') std::cout << ' '; } std::string getData(bool isStr) { std::string data, prev; while (getline(std::cin, data)) std::swap(prev, data); if (!data.empty() && (isStr || (std::isdigit(data.at(0)) || !std::isalpha(data.at(0))))) return data; return prev; } std::string getLine FUNC std::string data; getline(std::cin, data); return data; } int getInt FUNC return std::stoi(getData(false)); } double getReal FUNC return std::stod(getData(false)); } const boost::array<std::string, 6> TRUTHY {{ "y", "yes", "yep", "ok", "fine", "true", }}; bool getYN FUNC std::string data = getData(true); data.erase(std::remove_if(data.begin(), data.end(), ::isspace), data.end()); std::transform(data.begin(), data.end(), data.begin(), ::tolower); for (const std::string& str: TRUTHY) { if (data == str) return true; } return false; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: