Question: C++ programming An avid Harry Potter fan recently read about the Black Punishment Quill that Dolores Umbridge invented and inflicted on Harry several times while

C++ programming

An avid Harry Potter fan recently read about the Black Punishment Quill that Dolores Umbridge invented and inflicted on Harry several times while she served as the Hogwarts High Inquisitor in the book, Order of the Phoenix. According to the Harry Potter Lexicon, the quill is "A long, thin black quill with an unusually sharp point, this quill does not use ink. Instead, when used to write, it magically slices into the back of the hand holding it and draws blood in place of ink. The cuts at first heal immediately, but over a long session the damage will be repaired more and more slowly, until the hand is finally left raw and bleeding."  The sentence she always instructed Harry to write, over and over again, until his hand was bleeding and eventually scarred permanently, was, "I must not tell lies." Write a C++ program that outputs this sentence 40 times, numbering each sentence, but also uppercases each word in the sentence, one at a time, in forward sequence, and then in reverse sequence once the final word of the sentence is reached, over and over again, like this:
 
1   I must not tell lies. 2   i MUST not tell lies. 3   i must NOT tell lies. 4   i must not TELL lies. 5   i must not tell LIES. 6   i must not TELL lies. 7   i must NOT tell lies. 8   i MUST not tell lies. 9   I must not tell lies. 10  i MUST not tell lies. 11  i must NOT tell lies. 12  i must not TELL lies.
 Output the list of forty sentences as described and partially shown above, using the pattern indicated. All sentences must be numbered, and then aligned exactly as shown. Use the C++ string class. The lines must not be hardcoded otherwise full credit will not be given. Output should be user friendly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!