Question: / / 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
