Skip to content

Instantly share code, notes, and snippets.

@Skarlso
Created November 26, 2016 21:25
Show Gist options
  • Save Skarlso/9108cfc7a45fdb84d7e094fff1a217cf to your computer and use it in GitHub Desktop.
Save Skarlso/9108cfc7a45fdb84d7e094fff1a217cf to your computer and use it in GitHub Desktop.
// Copyright [2016] <Gergely Brautigam>
#include "./bob.h"
#include <boost/algorithm/string.hpp>
#include <string>
std::string bob::hey(std::string text) {
boost::trim_right(text);
if (text.empty()) {
return "Fine. Be that way!";
}
if (text == boost::to_upper_copy<std::string>(text)
&& text != boost::to_lower_copy<std::string>(text))
return "Whoa, chill out!";
else if (text.back() == '?')
return "Sure.";
else
return "Whatever.";
}
#ifndef BOB_H
#define BOB_H
#define EXERCISM_RUN_ALL_TESTS
#include <string>
namespace bob {
std::string hey(std::string text);
}
#endif // BOB_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment