Question
C++ (1) Get a line of text from the user. Output that line. Then output the line again, this time expanding all of the found
C++ (1) Get a line of text from the user. Output that line. Then output the line again, this time expanding all of the found common text message abbreviations. You can do this by using a loop. Ex:
Enter text: My BFF is David. IDK who your BFF is. You entered: My BFF is David. IDK who your BFF is. Expanded: My best friend forever is David. I don't know who your best friend forever is.
Support these abbreviations:
BFF -- best friend forever
IDK -- I don't know
JK -- just kidding
TMI -- too much information
TTYL -- talk to you later
Note: If an abbreviation appears more than once, every instance gets expanded.
I am having trouble with the "Expected: " part of the code. I am unsure how to loop the abbreviation if it appears more than once.
1. Compare output Your bff, my BFF, and her BFF are all there Input Enter text: Your You entered Your bff, my BFF, and her BFF are all here output Expanded Your bff, my best friend forever and her best friend forever are all there 2. Compare output Are you really going to wear that? Haha, JK, JK Input Enter text: You entered: Are you really going to wear that? Haha. JK, JK Your output Expanded Are you really going to wear that? Haha, JK, JK. Enter text: You entered: Are you really going to wear that? Haha JK, JK Expected output Expanded: Are you really going to wear that? Haha, just kidding, just kidding. 3. Compare output Input TMI Just TMI I'll TTYL Enter text: You entered TMI Just TMI I'll TTYL. Your output Expanded TMI Just TMI I'll TTYL. Enter text
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started