1
0
Fork 0
This repository has been archived on 2021-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
uni-m.cds-adv-prog/ex3.2/main.cpp

36 lines
648 B
C++
Raw Normal View History

2019-12-12 15:56:38 +01:00
#include <iostream>
#include "Stack.hh"
/*
* Dynamically Sized Stack Implementation
*/
using namespace std ;
int main() {
Stack s(10) ;// initialize Stack
// Write doubles into Stack
int i ;
for (i=0 ; i<15 ; i++) {
cout << "pushing value " << i*i << " in stack" << endl ;
s.push(i*i) ;
}
// Count doubles in fifo
cout << s.nitems() << " value in stack" << endl ;
cout << "Inspect the FIFO" << endl;
s.inspect();
// Read doubles back from fifo
while (!s.empty()) {
double val = s.pop() ;
cout << "popping value " << val << " from stack" << endl ;
}
cout << "Inspect the FIFO" << endl;
s.inspect();
return 0 ;
}