Write a program that reads a sequence of integers from cin and writes yes on cout if that sequence of integers is a palindrome of even size and writes no if it is not. Recall that a palindrome is a sequence that is the same when read from left to right or from right to left. So, the sequence 441263362144 is a palindrome, while the sequence 141267362144 is not.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

This question involved the use of stack and queue (like u see below)

Those are the class definitions for stacks and queues of integers (like u see below)

Need the solution of the program step-by-step please!

class Stack (// integer stack:
Stack(); // construct empty stack
void push(int k); // push k on the top of the stack
int pop(); // delete item on top of the stack & return a copy of it
int top(); // return a copy of item on top of the stack
bool isEmpty(); // true if stack is empty, otherwise false
};
class Queue (// integer queue:
Queue(); // construct empty queue
void insert(int k); // insert k at the rear of the queue
int remove(); // delete item at front of the queue & return a copy of it
int front(); // return a copy of item at front of the queue
bool isEmpty(); // true if queue is empty, otherwise false
};
Write a program that reads a sequence of integers from cin and writes yes on cout if
that sequence of integers is a palindrome of even size and writes no if it is not. Recall
that a palindrome is a sequence that is the same when read from left to right or from
right to left. So, the sequence 441263362144 is a palindrome, while the sequence
441267362144 is not.
Transcribed Image Text:class Stack (// integer stack: Stack(); // construct empty stack void push(int k); // push k on the top of the stack int pop(); // delete item on top of the stack & return a copy of it int top(); // return a copy of item on top of the stack bool isEmpty(); // true if stack is empty, otherwise false }; class Queue (// integer queue: Queue(); // construct empty queue void insert(int k); // insert k at the rear of the queue int remove(); // delete item at front of the queue & return a copy of it int front(); // return a copy of item at front of the queue bool isEmpty(); // true if queue is empty, otherwise false }; Write a program that reads a sequence of integers from cin and writes yes on cout if that sequence of integers is a palindrome of even size and writes no if it is not. Recall that a palindrome is a sequence that is the same when read from left to right or from right to left. So, the sequence 441263362144 is a palindrome, while the sequence 441267362144 is not.
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning