Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) State exactly what property the string input by the user must have for the program below to print Yes... Explain the program logic

image text in transcribed

(a) State exactly what property the string input by the user must have for the program below to print "Yes..." Explain the program logic concisely but clearly (i.e. give the key steps). (2 marks) int main() { } char c; bool check = true; stack cstack; queue cqueue; cout < < "Enter a string and press return." < < endl; cin.get( c ); while (c!= ' ') { } cstack.push( c ); cqueue.push( c ); cin.get( c ); while (check && !cqueue.empty() ) { } if (cstack.top() != cqueue.front()) check = false; cstack.pop(); cqueue.pop(); if (check cout < < "Yes it is!" < < endl; else cout < < "No it's not." < < endl; return 0; (b) Explain clearly what performance issue the above program has, and suggest how to fix it. No code is needed; just explain briefly. (2 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

a The string input by the user must have the property of being a palindrome for the program to print ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

What degrees does the program offer?

Answered: 1 week ago

Question

What is the standard deviation for Exercise 2?

Answered: 1 week ago