Question: C++ PROGRAMMING RHYMES.CPP Write a program that finds rhyming words in a poem. Specifically, the program reads an input file, line by line, and extracts

C++ PROGRAMMING

C++ PROGRAMMING RHYMES.CPP Write a program that finds rhyming words in a

poem. Specifically, the program reads an input file, line by line, and

extracts the last word in each line. It then compares this last

word with the last word from the line after it. If it

RHYMES.CPP Write a program that finds rhyming words in a poem. Specifically, the program reads an input file, line by line, and extracts the last word in each line. It then compares this last word with the last word from the line after it. If it finds that the 2 words "rhyme" (which is simply defined as the 2 words that are being compared share the same 2 last letters), then it prints out these two words to standard output (i.e. the display). But FIRST, the words must be cleaned up of any non-alphabetical characters (usually this means puncuation, since many poems have their last lines often end with a comma, a semicolon, a question-mark, etc...) So if the last word on a line has punctuation marks on it, e.g "hello?!", it becomes "hello". Or if the last word is "don't", it becomes "dont". Finally, the program has to state how many rhyming pairs it found, or if it did not find any at all The program has to ask the user for the file name and has to check to see if the file exists (use the string "Enter file name: "for the question). If it does not exist, the program must output (via cerr) an error message: "Input file opening failed." and then exit with code 1

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 Databases Questions!