To make the task a little easier the words in the file are


A word palindrome reads the same backwards as forwards, if you take the unit to be a word. For example, "so PATIENT A DOCTOR TO DOCTOR A PATIENT SO." In this assignment use a vector of strings. Read words from a file until you come to the end of a line. Store each word as one of the elements of a vector. Thus in the example, from the first line of the file, you would store in the vector's [0] position the string so and in the vector's [1] position the string PATIENT and in the vector's [2] position the string A and in the vector's [3] position the string DOCTOR and so forth. Do not declare the vector with the number of positions to be reserved at the outset. Instead use push_back and later .size() to find out how many positions were needed.

Then have your program call a function into which you pass the vector and its size, and have the function determine if you have a word palindrome. Pass back to the main program a bool variable that is true if you do have a word palindrome, and false if you don't. Then in the main program, print out the line of words and a statement saying whether it is a word palindrome.

To make the task a little easier, the words in the file are all in capitals, but each line does contain punctuation. Do not change what is in the file. Instead, write your program general enough to handle it.

SO PATIENT A DOCTOR TO DOCTOR A PATIENT SO.
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
YOU CAN CAGE A SWALLOW, CAN'T YOU, BUT YOU CAN'T SWALLOW A CAGE, CAN YOU? BORES ARE PEOPLE THAT SAY THAT PEOPLE ARE BORES.
EARLY TO BED AND EARLY TO RISE MAKES A MAN HEALTHY, WEALTHY, AND WISE. BEAUTY IS AS BEAUTY DOES.
DOES MILK MACHINERY MILK DOES?
GOD KNOWS MAN. WHAT IS DOUBTFUL IS WHAT MAN KNOWS GOD.
LEATHERY SKIN IS SKIN LEATHER.
HIDE! HIDE! THE COW'S OUTSIDE!
YOU HUNT WOLVES; WOLVES HUNT YOU

Solution Preview :

Prepared by a verified Expert
Other Subject: To make the task a little easier the words in the file are
Reference No:- TGS0654907

Now Priced at $40 (50% Discount)

Recommended (95%)

Rated (4.7/5)