Branching – Tweet decoder step 2
//Program that prints abbreviations in a tweet
include
include
using namespace std;
int main() {
string tweet;
int pos;
cout << "Enter your tweet: ";
getline(cin, tweet);
tweet.resize(160);
pos = tweet.find("LOL");
if (pos >= 0) {
cout << "LOL = laughing out loud" << endl;
}
pos = tweet.find("IRL");
if (pos >= 0) {
cout << "IRL = in real life" << endl;
}
pos = tweet.find("AFK");
if (pos >= 0) {
cout << "AFK = away from keyboard" << endl;
}
pos = tweet.find("NVM");
if (pos >= 0) {
cout << "NVM = never mind" << endl;
}
pos = tweet.find("BFF");
if (pos >= 0) {
cout << "BFF = best freinds forever" << endl;
}
pos = tweet.find("FTW");
if (pos >= 0) {
cout << "FTW = for the win" << endl;
}
pos = tweet.find("IIRC");
if (pos >= 0) {
cout << "IIRC = if I recall correctly" << endl;
}
pos = tweet.find("TTYL");
if (pos >= 0) {
cout << "TTYL = talk to you later" << endl;
}
pos = tweet.find("IMHO");
if (pos >= 0) {
cout << "IMHO = in my humble opinion" << endl;
}
system(“pause”);
return 0;
}
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
