// stackdr.cpp in StackType2/

#include <iostream>
#include "StackType.h"

using namespace std;

struct thingee {    //example struct
  int i;
  char c;
  float f;
};


int main() {

  StackType<int> s1;      //stack of ints.  template parameter is int
  StackType<char> s2;     //stack of chars
  StackType<thingee> s3;  //stack of thingees

  int num;
  char ch;
  thingee t;

  // int stack
  cout << "Enter numbers, negative number to stop" << endl;
  do {
    cin >> num;
    if (num >= 0)
      s1.Push(num);  //argument of Push function of int Stack is an int
  } while (num >= 0);

  cout << endl << "The numbers in reverse order are:" << endl;

  while (!s1.IsEmpty()) {
    s1.Pop(num);
    cout << num << "  ";
  }
  cout << endl << endl;
  cout << "----------------------------------------------------------" << endl;

  // char stack
  cout << "Enter characters, pound sign (#) to stop" << endl;
  do {
    cin >> ch;
    if (ch != '#')
      s2.Push(ch);
  } while (ch != '#');

  cout << endl << "The characters in reverse order are:" << endl;

  while (!s2.IsEmpty()) {
    s2.Pop(ch);
    cout << ch << "  ";
  }
  cout << endl << endl;
  cout << "----------------------------------------------------------" << endl;


  // thingee stack
  cout << "Enter thingee records (int, char, float), negative number to stop" << endl;
  do {
    cin >> t.i >> t.c >> t.f;
    if (t.i >= 0)
      s3.Push(t);
  } while (t.i >= 0);

  cout << endl << "The thingees in reverse order are:" << endl;

  while (!s3.IsEmpty()) {
    s3.Pop(t);
    cout << t.i << "  " << t.c << "  " << t.f << endl;
  }
  cout << endl;
  cout << "----------------------------------------------------------" << endl;

}
