Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3 ) This programming problem deals with the template - based stack StackType and queue QueType implementations, as well as C + + strings. (
This programming problem deals with the templatebased stack StackType and queue QueType implementations, as well as C strings. pts
Note that you must use the provided StackType.h and QueType.h files found attached with the assignment. Also, be certain to adhere to the example below in using the standard library std::string as arguments and not a character array as input, since we will test it using strings.
You are to create a function decode in a file stringdecoding.cpp with the following signature:
std::string decodestd::string exp, std::string code
The function body should satisfy the following characteristics:
The function must iterate through each character in exp recommended is to use the std::string at function and take one of two actions:
i Characters in the string exp that are not also in the string code should be present in output in normal, sequential order as they are encountered, without modification.
ii All characters in the string exp that are also present in the string code should be present in output after the characters printed in normal order from part i AND entirely in reverse order.
Sample input and output for reference is as follows:
decodeczitqommtaehmumtnioszozireulopupoayehtacefhilnpst"
must return the following string:
"zqommmumozozruouoytheappleisintheattic"
As alluded to above, the recommended approach is to:
Create StackType and QueType instances of the appropriate types and add characters to them until the end of string exp is reached.
Put together the output string using appropriate operations using to criteria i and ii above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started