Write your program general enough to handle it

Assignment Help Other Subject
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

Reference no: EM13316227

Questions Cloud

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..

Reviews

Write a Review

 

Other Subject Questions & Answers

  The flow of white collar jobs out of the country

There is a difference between the transference of high paying white collar jobs, such as computer programming and accounting, to developing nations and low paying blue collar jobs?

  Direction given by top management

There have been so many companies and situations that have had a major breach of ethics. Companies like Worldcom, Tyco, and the infamous Enron have been the poster children for bad ethical conduct. As a result, a target has been fixed on the "heart o..

  Describe three types of intermediate sanctions

Describe three types of intermediate sanctions. What is the purpose of intermediate sanctions, and what is their effectiveness in reducing recidivism? Predict whether or not community based corrections will increase or decrease over the next 20 years..

  According to john winthrop

According to John Winthrop, the Puritans would “be as a __________ [and] all the eyes of all people are upon us.”

  Use of technology in marketing

What are some of the ethical considerations that marketing professionals face? How do these situations develop, and how should they be addressed?

  Governs protected health information

Identify the federal law that governs Protected Health Information (PHI) and briefly discuss the elements of compliance. Describe two specific examples of improper privacy disclosure and discuss the challenges of maintaining strict confidentiality in..

  Disaster recovery and business continuity

Differentiate between disaster recovery and business continuity.

  Endcap portion about plastec-metrics mentioned

Review the Endcap portion (below) about Plastec. In addition to the metrics mentioned, what other metrics do you think this company (considering the size, type of business, etc.) should track, and why?"

  Responsible for implementing a particular marketing strategy

If you were personally responsible for implementing a particular marketing strategy, which implementation approach would you be most comfortable using, given your personality and personal preferences? Why?

  Differences between a traditional hazard

Discuss two major differences between a traditional hazard such as the 2007 California Wildfires and the terrorist-related hazards associated with the Aum Shinrikyo Sarin Gas attack on the Tokyo Subway that occurred in March of 1995.

  Discuss connection between health policies-health

Discuss the connection between health policies, health determinants, and health.

  Appropriate fiscal policy

If the economy is at potential output, and consumption spending suddenly decreases due to a fall in consumer confidence, the appropriate fiscal policy is?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd