Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ / Student ID: 2 0 5 3 7 0 1 6 / / TODO - Replace the number above with your actual student ID
Student ID: TODO Replace the number above with your actual student ID
#ifndef Stacksh
#define Stacksh
#include
#include
#include
class StackInt
private:
std::vector data;
public:
No explicit constructor or destructor
sizet size const return data.size;
bool isempty const return data.size;
void pushint valdata.pushbackval;
int topbool& success const
if isempty
success false;
return ;
else
success true;
return data.back;
bool pop
if isempty
return false;
data.popback;
return true;
bool popint& val
if isempty
val ;
return false;
val data.back;
data.popback;
return true;
std::string tostring const
std::stringstream ss;
ss "Stack size elements: std::endl;
sizet count std::minsize staticcast;
for sizet i ; i count; i
ss datasize i std::endl;
if size
ss std::endl;
ss "Elements, if listed above, are in increasing order of age." std::endl;
return ssstr;
Don't remove the following line
friend class Tests;
;
class StackString
private:
std::vector data;
public:
No explicit constructor or destructor
sizet size const return data.size;
bool isempty const return data.size;
void pushstd::string valdata.pushbackval;
std::string topbool& success const
if isempty
success false;
return ;
else
success true;
return data.back;
bool pop
if isempty
return false;
data.popback;
return true;
bool popstd::string& val
if isempty
val ;
return false;
val data.back;
data.popback;
return true;
std::string tostring const
std::stringstream ss;
ss "Stack size elements: std::endl;
sizet count std::minsize staticcast;
for sizet i ; i count; i
ss datasize i std::endl;
if size
ss std::endl;
ss "Elements, if listed above, are in increasing order of age." std::endl;
return ssstr;
Don't remove the following line
friend class Tests;
;
#endif Stacksh i use this code but stiil i got the error please give me correct code Hooray! Rogues from Rombarchia befriended Basic Stack
Hooray! Light Emitting Weevils adopted Push
Hooray! Qubits of Inner Space leased Top
Hooray! Golden Rhinoceri won in a duel Pop
Hooray! Sprinchots of Smoltassium insufflated... dangerous! Pop
Checkpoint failed. Your tostring said:
Stack elements:
Elements, if listed above, are in increasing order of age.
But mine said:
Stack elements:
Elements, if listed above, are in increasing order of age.
Here is your stack:
Stack elements:
Elements, if listed above, are in increasing order of age.
And here is mine:
Stack elements:
Elements, if listed above, are in increasing order of age.
You think that's it
& this error is coming please give me correct code this is my rd time i am posting this question
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