From 755af6eee96bfa2c061d29ca575e0743b0e5a936 Mon Sep 17 00:00:00 2001 From: starnakin Date: Wed, 22 Nov 2023 14:14:03 +0100 Subject: [PATCH] add main ex02 --- ex02/src/main.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 ex02/src/main.cpp diff --git a/ex02/src/main.cpp b/ex02/src/main.cpp new file mode 100644 index 0000000..4e81ea2 --- /dev/null +++ b/ex02/src/main.cpp @@ -0,0 +1,60 @@ +#include "MutantStack.hpp" +#include +#include + +int main() +{ + { + std::cout << "Test with MutantStack" << std::endl; + + MutantStack l; + + l.push(12); + l.push(13); + l.push(14); + l.push(15); + l.push(16); + l.push(17); + + std::cout << l.top() << std::endl; + l.pop(); + std::cout << l.top() << std::endl; + + std::cout << "Size of stack: " << l.size() << std::endl; + + MutantStack::iterator it; + MutantStack::iterator const ite = l.end(); + + for (it = l.begin(); it != ite; ++it) { + std::cout << *it << ' '; + } + std::cout << std::endl; + } + { + std::cout << std::endl << + "Test with std::list" << std::endl; + + std::list l; + + l.push_back(12); + l.push_back(13); + l.push_back(14); + l.push_back(15); + l.push_back(16); + l.push_back(17); + + std::cout << l.back() << std::endl; + l.pop_back(); + std::cout << l.back() << std::endl; + + std::cout << "Size of stack: " << l.size() << std::endl; + + std::list::iterator it; + std::list::iterator const ite = l.end(); + + for (it = l.begin(); it != ite; ++it) { + std::cout << *it << ' '; + } + std::cout << std::endl; + } +} \ No newline at end of file