I want this to say "I am laughing out loud"

So far this is only printing "laughing out loud, I want it to print the whole sentence if the input is: "I am LOL." I want it to say "I am laughing out loud"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  #include <iostream>
#include <string>
using namespace std;

int main() {
  string tweet;
  unsigned int pos = 0;
  

  cout << "\nEnter tweet:"; // User enters a complete tweet (160 characters or less)
  getline(cin, tweet);  // Gets the single line of text
  tweet.resize(160);  // Resizes to 160 characters
 
  
  pos = tweet.find("LOL");
  if (pos != string::npos) {	                                              // Note: This expression asks: Does the tweet have "LOL" anywhere?
     tweet.replace(pos, 0, "laughing out loud");
	 cout << "laughing out loud\n";
  }
You need to print your tweet,
Thank you so much. I finally finished the whole thing except now there will be some random capital letter at the end of a word in the decoded tweet.
#include <iostream>
#include <string>
using namespace std;

int main() {
  string tweet;
  unsigned int pos;
  string::npos;

  cout << "\nEnter tweet:"; // User enters a complete tweet (160 characters or less)
  getline(cin, tweet);  // Gets the single line of text
  tweet.resize(160);  // Resizes to 160 characters
 
  
  pos = tweet.find("LOL");
  if (pos != string::npos) {
	 tweet.replace(pos, 3, "laughing out loud");  // Note: This expression asks: Does the tweet have "LOL" anywhere?
  }
 // cout << tweet << endl;


  


  pos = tweet.find("IRL");
  if (pos != string::npos) {
	 tweet.replace(pos, 3, "in real life");  // Note: This expression asks: Does the tweet have "LOL" anywhere?
  }
  //cout << tweet << endl;

  pos = tweet.find("AFK");
  if(pos != string::npos) {
	tweet.replace(pos, 3, "away from keyboard");  // Note: This expression asks: Does the tweet have "LOL" anywhere?
  }
  //cout << tweet << endl;

  pos = tweet.find("NVM");
  if (pos != string::npos) {
	  tweet.replace(pos, 3, "nevermind");  // Note: This expression asks: Does the tweet have "LOL" anywhere?
  }
  //cout << tweet << endl;

  pos = tweet.find("BFF");
  if (pos != string::npos) {
	 tweet.replace(pos, 3, "best friends forever");  // Note: This expression asks: Does the tweet have "LOL" anywhere?
  }
 // cout << tweet << endl;

    // Note: This expression asks: Does the tweet have "LOL" anywhere?
  pos = tweet.find("FTW");
  if (pos != string::npos) {
	 tweet.replace(pos, 3, "for the win");
  }
  //cout << tweet << endl;

  pos = tweet.find("IIRC");
  if (pos != string::npos) {
	 tweet.replace(pos, 3, "if I recall correctly");
  }
  //cout << tweet << endl;

  pos = tweet.find("TTYL");
  if (pos != string::npos) {
	 tweet.replace(pos, 3, "talk to you later");
  }
 // cout << tweet << endl;

  pos = tweet.find("IMHO");
  if (pos != string::npos) {
	 tweet.replace(pos, 3, "in my humble opinion");
  }
  cout << "Decoded tweet: " << tweet << endl;

  return 0;
}
there will be some random capital letter at the end of a word in the decoded tweet.
1
2
3
pos = tweet.find("IIRC");
  if (pos != string::npos) {
	 tweet.replace(pos, 3, "if I recall correctly");

The capital letter is the left-over from the find string. You need to replace all 4 chars not 3.
OK got it, but now I have the left brace issue (C1075) Dont know what else to try.
Can you post the code?
Topic archived. No new replies allowed.