...
Code Block |
---|
#include <iostream> #include "stack.h" using namespace std ; void main() { typedefStack Stack<float><float> FloatStack ; typedefStack Stack<int><int> IntStack ; FloatStack fs(5) ; float f = 1.1 ; cout << "Pushinglaitetaan elementsluku ontoreaalilukupinoon fs" << endl ; while (fs.push(f)) { cout << f << ' ' ; f += 1.1 ; } cout << endl << "StackPino Fulltäynnä." << endl << endl << "PoppingOtetaan elementselementi from fspinosta" << endl ; while (fs.pop(f)) cout << f << ' ' ; cout << endl << "Stackpino Emptytyhjä" << endl ; cout << endl ; IntStack is ; int i = 1.1 ; cout << "Pushinglaitetaan elementsluku onto iskokonaislukupinoon" << endl ; while (is.push(i)) { cout << i << ' ' ; i += 1 ; } cout << endl << "Stackpino Fulltäynnä" << endl << endl << "Poppingotetaan elementselementti from ispinosta" << endl ; while (is.pop(i)) cout << i << ' ' ; cout << endl << "Stackpino Emptytyhjä" << endl ; } |