Sorting dynamic stack?

Sep 26, 2013 at 1:39pm
Create a program that contains the following functions:
-create two dynamic stacks with integer data contained in an external file.
-Sort items in stacks by the selection sort method
-Record outputs in an external file.
Main function main ()-menu selection functions and check the status of the data

I shouldn`t use arrays or STL only can use vectors but i dont know how to do it howw to make dynamic stack with vectors and how to sort it with selection sort?

Someone help? Sorry for bad english
Sep 26, 2013 at 1:47pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class dynamic_stack{
private:
   std::vector<T> data;
public:
   void push(const T &obj){
      data.push_back(obj);
   }
   void pop(){
      data.pop_back();
   }
   T& top(){
      return data.back();
   }
};


http://en.wikipedia.org/wiki/Selection_sort
Last edited on Sep 26, 2013 at 1:48pm
Topic archived. No new replies allowed.