hi guys, im trying to complete a function where you have stack S and stack T. Both integer type and both have 4 elements in each stack which the elements are in ascending order (Top to bottom (eg..1 2 3 4 7 8)). Now i have to combine both stacks and make one union stack which combines both stacks S and T and puts that stack in ascending order.
my program only outputs 5 elements and not 8 (combining of both S and T).
any1 know why i can only get 5 and not all 8 into the unionStack that unites both S and T and puts all the numbers in ascending order? thank u!
stack <int> unionS(stack<int>& S, stack<int>& T)
stack <int> unionStack;
stack <int> a;
stack <int> b;
for(int j = S.size(); j>0; j--)
for(int g = T.size(); g>0; g--)
cout<<a.size()<<" ELEMENTS IN STACK a";
cout<<b.size()<<" ELEMENTS IN STACK b";
for(int x = 0; x<=(a.size())+(b.size()); x++)