Write a complete C++ program to check whether the string input is similar when it reads...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a complete C++ program to check whether the string input is similar when it reads the same backwards as forwards using queue algorithms based on the instructions given. In the class ADTqueue, write all functions such as empty(), full(), append(...) and serve(). In the main() function: Get input string from user and check the length of the string. Call an append(...) function to add the letter into the queue. Repeat the process until all letter has been stored in the queue. Call a function serve() and store the letter to the new variable string. Repeat the process until the queue is empty. Compare the inputs string. If the strings are the same then display the message "it is same". Repeat this process if user wish to continue. Sample Output: Enter a word [Letter must be in lowercase]: pop pop is same Do you want to continue : Y Enter a word (Letter must be in lowercase]: peter peter is NOT same. Do you want to continue: Y Enter a word [Letter must be in lowercase]: madam madam is same Do you want to continue : Y Enter a word [Letter must be in lowercase]: rotator rotator is same Do you want to continue : Y Enter a word [Letter must be in lowercase]: door door is NOT same Do you want to continue : Y Enter a word [Letter must be in lowercase]: reviver reviver is same Do you want to continue : N Write a complete C++ program to check whether the string input is similar when it reads the same backwards as forwards using queue algorithms based on the instructions given. In the class ADTqueue, write all functions such as empty(), full(), append(...) and serve(). In the main() function: Get input string from user and check the length of the string. Call an append(...) function to add the letter into the queue. Repeat the process until all letter has been stored in the queue. Call a function serve() and store the letter to the new variable string. Repeat the process until the queue is empty. Compare the inputs string. If the strings are the same then display the message "it is same". Repeat this process if user wish to continue. Sample Output: Enter a word [Letter must be in lowercase]: pop pop is same Do you want to continue : Y Enter a word (Letter must be in lowercase]: peter peter is NOT same. Do you want to continue: Y Enter a word [Letter must be in lowercase]: madam madam is same Do you want to continue : Y Enter a word [Letter must be in lowercase]: rotator rotator is same Do you want to continue : Y Enter a word [Letter must be in lowercase]: door door is NOT same Do you want to continue : Y Enter a word [Letter must be in lowercase]: reviver reviver is same Do you want to continue : N
Expert Answer:
Answer rating: 100% (QA)
Heres a complete C program that implements the described functionality using a queue algorithm cpp i... View the full answer
Related Book For
Business Statistics Communicating With Numbers
ISBN: 9780078020551
2nd Edition
Authors: Sanjiv Jaggia, Alison Kelly
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
In this question assume that p and q are atomic formulae. (a) Compare and contrast path formulae and state formulae in temporal logic. [4 marks] (b) Describe and contrast the meanings of F(G p) and...
-
93) Clay of the Land is a manufacturer of glazed clay pots. Currently, it produces 300 clay pots per month which it sells through nurseries at a constant price of $5 per pot. Current demand for clay...
-
According to an analysis, a sample of phosphate rock contains 71.2% Ca3(PO4)2, by mass. How many grams of calcium dihydrogen phosphate, Ca(H2PO4)2, can be obtained from 10.0 g of phosphate rock from...
-
When calculating the total kinetic energy (initial state before collision) it is just the sum of the kinetic energy of item 1 + kinetic energy of item 2 (both at the initial state before collision)...
-
OPEC nations have obviously preferred portfolio investments abroad to direct foreign investment. How does the theory of market imperfections explain this preference?
-
The following empirical equation correlates the values of variables in a system in which solid particles are suspended in a flowing gas: Both (?/pD) and (d p up/?) are dimensionless groups; kg is a...
-
Consider the spring assembly shown in Fig. ( a ) Obtain the global stiffness matrix for the full spring assembly. Take the determinant of the matrix you obtained ( you can do this using software, e ....
-
Assume that three restaurant owners have decided to pool their losses together; each owns an identical restaurant valued at $600,000. Suppose that there is a 4% chance in any year each restaurant...
-
On January 23, 2006, CNET News.com quoted an anonymous source describing strategic plans made at a meeting of HPs board of directors. Because the meeting was held behind closed doors and with a...
-
To what extent do you think that buyer behaviour can be reduced to rules-based models applicable to a variety of service buying situations?
-
What are the duties of landlords and tenants?
-
What are some examples of when a court should interfere with the activities of a private association? Why do you think this is important to the sport industry?
-
Earth Sciences, Inc., conducted gold-leaching operations in Colorado. The process involved spraying gold ore with a toxic substance. To prevent pollution, Earth Sciences had installed a reserve sump...
-
Write an essay that discusses why oral communication skills, listening and interpersonal abilities skills are considered so important within an organization that wants to enhance its service...
-
Suppose the concentration of glucose inside a cell is 0.1 mm and the cell is suspended in a glucose solution of 0.01 mm. a. What would be the free energy change involved in transporting 10-o mole of...
-
Consider the flow of a perfect gas along a Fanno line. Show that the pressure at the * reference state is given by the relation 1/2 m 2RT, P Ayge(y+1)
-
Air flows in an 8-cm-inside diameter pipe that is \(4 \mathrm{~m}\) long. The air enters with a Mach number of 0.45 and a temperature of \(300 \mathrm{~K}\). (a) What friction factor would cause...
-
Air enters a duct with a mass flow rate of \(35 \mathrm{lbm} / \mathrm{sec}\) at \(T_{1}=520^{\circ} \mathrm{R}\) and \(p_{1}=20 \mathrm{psia}\). The duct is square and has an area of \(0.64...
Study smarter with the SolutionInn App