1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <string>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <cctype>
template <typename cArray>
bool isin(const std::string& str, const cArray& array) {
return std::find(std::begin(array), std::end(array), str) != std::end(array);
}
std::string to_lower(std::string str) {
for (auto& c : str)
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
return str;
}
int main() {
constexpr const char* weezerresponses[] {"weez"};
constexpr const char* nirvanabadresponses[] {"i dont like nirvana", "i don't like nirvana", "i do not like nirvana",
"fuck nirvana", "nirvana sucks", "nirvanas trash", "nirvana is trash",
"nirvanas garabage", "nirvana is garbage", "nirvana blows",
"nirvana sucks balls", "nirvanas ass", "nirvana is ass"};
constexpr const char* britishpunkresponses[] {"u/britishpunk149", "britishpunk149"};
std::string mood;
std::cout << "Oh hey! How are you feeling today? ";
std::getline(std::cin, mood);
if (const auto lc_mood {to_lower(mood)}; isin(lc_mood, weezerresponses))
std::cout << "Get laid, virgin.\n";
else if (isin(lc_mood, nirvanabadresponses))
std::cout << "Yeah... you're right :/\n";
else if (isin(lc_mood, britishpunkresponses))
std::cout << "Oh yeah man! I freaking LOVE u/britishpunk149!!! I am her biggest fan :D\n";
else
std::cout << "of course I've got this terrible pain in all the diodes down my left hand side\n";
}
|