Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C + + Help Need help with main.cpp Instructions: Write a program that reads a line of text, changes each uppercase letter to lowercase, and

C++ Help Need help with main.cpp
Instructions: Write a program that reads a line of text, changes each uppercase letter to lowercase, and places each letter both in a queue and onto a stack.
The program should then verify whether the line of text is a palindrome (a set of letters or numbers that is the same whether read forward or backward).
If the input text is a palindrome, the program should print The line of text you entered is a palindrome.
If the input text is not a palindrome, the program should print The line of text you entered is not a palindrome.
my main.cpp
#include
#include
#include
#include
using namespace std;
int main(){
stack stk;
queue que;
cout << "Enter a line of text: ";
string line;
getline(cin, line);
for (char c : line){
c = tolower(c);
stk.push(c);
que.push(c);
}
bool isPalindrome = true;
while (!stk.empty() && !que.empty()){
if (stk.top()!= que.front()){
isPalindrome = false;
break;
}
stk.pop();
que.pop();
}
if (isPalindrome){
cout << "The line of text you entered is a palindrome." << endl;
} else {
cout << "The line of text you entered is not a palindrome." << endl;
}
return 0;
}
My problem is in the rubric:
Status: FAILED!
Check: 1
Test: Variable of type `stackType` is declared in *main.cpp*
Reason: Unable to find '.*stackType\s*<.+>.+' in the program.
Error : str - AssertionError
Status: FAILED!
Check: 1
Test: Variable of type `queueType` is declared in *main.cpp*
Reason: Unable to find '.*queueType\s*<.+>.+' in the program.
Error : str - AssertionError
Status: FAILED!
Check: 2
Test: Method `addQueue` called to add item to queue
Reason: Unable to find '.+\.\s*addQueue\s*\(.+\)' in the program.
Error : str - AssertionError
Status: PASSED!
Check: 3
Test: Method `front` is used to get item from front of queue
Reason: .+\.\s*front\s*\(.*\)+` was found in the program.None
Status: FAILED!
Check: 4
Test: Method `deleteQueue` is called to remove from front of queue
Reason: Unable to find '.+\.\s*deleteQueue\s*\(.*\)' in the program.
Error : str - AssertionError
I have myStack.h, queueADT.h, queueAsArray.h, and stackADT.h
I could put them here but they will be too long.
Please take your time and check to see if its runnable pls.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

understand what working means to workers;

Answered: 1 week ago

Question

How does interconnectivity change how we live and work?

Answered: 1 week ago