Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that uses the C++ string class to read in a line of text and rep

ID: 3562999 • Letter: W

Question

Write a program that uses the C++ string class to read in a line of text and replaces all four-letter words with the word " love".

For example, the input string
        I hate you, you dodo!
should produce the following output:
        I love you, you love!

Of course, the output will not always make sense.

For example, the input string
        John will run home.
should produce the following output:
      Love love run love.

If the four-letter word starts with a capital letter, it should be replaced by "Love" , not by "love".

You need not check capitalization, except for the first letter of a word.

A word is any string consisting of the letters of the alphabet and delimited at each end by a blank, the end of the line, or any other character that is not a letter.

Your program should repeat this action until the user says to quit.

Explanation / Answer

#include <iostream>

02 #include <string>
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote