problem solving

Q: Write functions in C++ to insert (push) element into a dynamically allocated stack in ascending order.?

I need the complete coding for this problem.

Last edited on
you can change int to whatever "element" might be.

std::stack<int>* sp = new std::stack<int>;
sp[0].push(3);

to push in order, get your data into a vector, sort it, and then push each element.
Last edited on
Topic archived. No new replies allowed.