Reference no: EM13316227
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
Find maximum thickness t of the strip at allowable stress
: A 900-mm strip of steel is bent into a full circle by two couples applied. Determine (a) the maximum thickness t of the strip if the allowable stress of the steel is 420 MPa, (b) the corresponding moment M of the couples.
|
Round your cost per equivalent unit amounts to two decimal
: Zither Co. manufactures a product called Zens in a three-process series. All materials are introduced at the beginning of the first process. Zither uses the first-in, first-out method of inventory costing. Unit and cost data for the first process (De..
|
Determine the force arm oa exerts on the smooth cylinder
: If arm OA rotates with a constant clockwise angular velocity of theta dot(first dirivatie)=1.5 rad/s. determine the force arm OA exerts on the smooth 4-lb cylinder B when theta=45 degrees.
|
How much charge has passed through this circuit
: A 10-A current flows for two minutes. How much charge has passed through this circuit
|
Write your program general enough to handle it
: 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.
|
Find how far the ball drops
: A pitcher throws horizontally a fast ball at 146 km/h toward home plate, which is 18 m away. find how far the ball drops because of gravity by the time it reaches home plate
|
Find the change in depth and in absolute water level produce
: Find the change in depth and in absolute water level produced by a) a smooth upward step of 1 ft b) a smooth donward step of 1 ft, in the channel bed c) find the maximum allowable size of thw upstream flow to be a possible as specified
|
A.lessons from the motor vehicle industry
: A.Lessons from the Motor Vehicle Industry
|
Sales to earn expected profit on proposed investment
: From the books of Aggarwal Bors, the following information have been extracted: Rs. Sales 2,40,000 Variable costs 1,44,000 Fixed costs 26,000 Profit before tax 70,000 Rate of tax 40% The firm is proposing to buy a new plant which can generate additio..
|