Course Solutions Uncategorized (Solved) : Instructions Two Stacks Type Number Elements Elements Corresponding Positions Overload Re Q33250184 . . . .

(Solved) : Instructions Two Stacks Type Number Elements Elements Corresponding Positions Overload Re Q33250184 . . . .

 

Instructions

Two stacks of the same type are the same if they have the samenumber of elements and their elements at the correspondingpositions are the same.

Overload the relational operator == for the class stackType thatreturns true if two stacks of the same type are the same; itreturns false otherwise.

Also, write the definition of the function template to overloadthis operator.

———————————————————————————————–

Main.cpp

#include <iostream>

#include “myStack.h”

using namespace std;

  

int main()

{

stackType<int> stack1(50);

stackType<int> stack2(50);

stack1.initializeStack();

stack1.push(23);

stack1.push(45);

stack1.push(38);

stack2 = stack1;

if (stack1 == stack2)

cout << “stack1 and stack2 are identical” <<endl;

else

cout << “stack1 and stack2 are not identical” <<endl;

stack2.pop();

stack2.push(32);

cout << “**** After pop and push operations on stack2****” << endl;

if (stack1 == stack2)

cout <<

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post