From 67c2c87a437afafb18cf0d8b969a3302d3a626be Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 17 Mar 2016 22:41:09 -0400 Subject: Added newlines to separate emojis from exclamation if there are too many emojis --- blessed.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'blessed.cpp') diff --git a/blessed.cpp b/blessed.cpp index 367d0d1..f3d90c4 100644 --- a/blessed.cpp +++ b/blessed.cpp @@ -44,6 +44,8 @@ int main(int argc, char** argv) emojis.push_back(line); } + emojifile.close(); + for (;;) { std::cout << "Generating tweet" << std::endl; @@ -66,14 +68,22 @@ int main(int argc, char** argv) std::string emojibef; std::string emojiaft; + int emn = 0; do { + emn++; std::string em = emojis[rand() % emojis.size()]; emojibef += em; emojiaft = em + emojiaft; - } while (rand() % 4 < 3); + } while (rand() % 2 == 0); - std::string result = emojibef + " " + exclamation + " " + emojiaft; + std::string result; + if (emn > 3) + { + result = emojibef + "\n" + exclamation + "\n" + emojiaft; + } else { + result = emojibef + " " + exclamation + " " + emojiaft; + } result.resize(140); std::string replyMsg; -- cgit 1.4.1