-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
36 lines (33 loc) · 1.87 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <string>
#include "stack.h"
using namespace std;
int main(void) {
cout << "Assignment #0 Test Program" << endl;
Stack<char> Char10; // Test Character Stack, Default constructor
Stack<float> Float5(5); // Test Float Stack
Stack<double> Double8(8); // Test Double Stack
Stack<bool> Bool2(2); // Test Bool Stack
Bool2.Push(true); // Test Push on Bool
Bool2.Push(false); // Test Push on Bool
Bool2.Push(true); // Test error on Push
cout << "Size of Bool2 is: "<< Bool2.Size()<<endl;
cout << "The number of elements in Bool2 is" << Bool2.Number()<<endl;
cout << "Top element of Bool2 is: " << Bool2.Top() <<endl;
cout << "Size on Double8 should be 8: "<< Double8.Size()<<endl;
Char10.Push('A');
Char10.Push('B');
Char10.Push('C');
cout << "Test Pop on Char10, should produce a 'C': ";
Char10.Pop();
Char10.Push('C');
cout << "Test ostream overload on Char10, should be a 'C': ";
cout <<Char10<< endl;
cout << "Test ostream overload on Char10, should be a 'B': ";
cout <<Char10<< endl;
cout << "Test ostream overload on Char10, should be a 'A': ";
cout <<Char10<< endl;
cout << "Test ostream overload on Char10, should be an error: ";
cout <<Char10<< endl;
return 0;
}