Advertisement
jtentor

DemoStack1 - Cpp - Main

May 9th, 2020
986
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. // Created by Julio Tentor <jtentor@fi.unju.edu.ar>
  3. //
  4.  
  5. #include <iostream>
  6. #include "stack.h"
  7.  
  8. int main() {
  9.     std::cout << "Demo de Stack - Pila" << std::endl;
  10.  
  11.     stack miPila = stack();
  12.  
  13.     miPila.push('a');
  14.     miPila.push('b');
  15.     miPila.push('c');
  16.  
  17.     while (!miPila.empty()) {
  18.         std::cout << miPila.pop() << std::endl;
  19.     }
  20.  
  21.     try {
  22.         miPila.pop();
  23.     }
  24.     catch (std::exception const & e) {
  25.         std::cout << e.what() << std::endl;
  26.     }
  27.  
  28.     return 0;
  29. }
Advertisement
RAW Paste Data Copied
Advertisement