Advertisement
TobiasM

main.cpp

Jul 19th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.12 KB | None | 0 0
  1. /* Programa para calcular promedios de vida de personajes del Imperium AO
  2.  * Creado por Tobias Nahuel Paiva Orzel Mallo
  3.  * http://tobiasmallo.wordpress.com/
  4.  *
  5.  * <Inicio de la licencia>
  6.  *
  7.  * Copyright (c) <2011> <Tobias Nahuel Paiva Orzel Mallo>
  8.  * All rights reserved.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *   notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *   notice, this list of conditions and the following disclaimer in the
  17.  *   documentation and/or other materials provided with the distribution.
  18.  *
  19.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20.  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  21.  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22.  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
  23.  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29.  * POSSIBILITY OF SUCH DAMAGE.
  30.  *
  31.  * <Fin de la licencia>
  32.  *
  33.  * main.cpp
  34.  */
  35.  
  36. #include <iostream>
  37. using std::cout;
  38. using std::cin;
  39. using std::endl;
  40.  
  41. #include <cstdlib>
  42.  
  43. #include "Calculator.h"
  44.  
  45. int main() // Esta parte requiere algo de trabajo tambien
  46. {
  47.   int menu = 0;
  48.   bool sigue;
  49.  
  50.   Calculator myCalculator;
  51.  
  52.   // Hay que crear un menu
  53.  
  54.   do {
  55.     cout << "======================================================================"
  56.     << "\nPrograma para calcular promedios de vida de personajes del Imperium AO"
  57.     << "\nCreado por Tobias Mallo\n"
  58.     << "\nhttp://tobiasmallo.wordpress.com/\n"
  59.     << "======================================================================"
  60.     << endl;
  61.    
  62.     // Aca comienzan las funciones de calculo
  63.     myCalculator.ingresoDatos();
  64.     myCalculator.calcularPromedio();
  65.     // Y aca finalizan
  66.    
  67.     // Esperar a que el usuario presione "Enter" para continuar
  68.     system("PAUSE");
  69.  
  70.     cout << "Que deseas hacer ahora?\n"
  71.     << "\n1_ Realizar nuevo calculo" << "\n2_ Salir\n"
  72.     << "\nElige: ";
  73.     cin >> menu;
  74.    
  75.     while ( menu < 1 || menu > 2 )
  76.     {
  77.       cout << "\nQue deseas hacer ahora?\n"
  78.       << "\n1_ Realizar nuevo calculo" << "\n2_ Salir\n"
  79.       << "\nElige: ";
  80.       cin >> menu;
  81.     }
  82.    
  83.     switch ( menu )
  84.     {
  85.       case 1:
  86.            sigue = true;
  87.            break;
  88.      
  89.       case 2:
  90.            sigue = false;
  91.            break;
  92.      
  93.     }
  94.      
  95.   } while ( sigue == true );
  96.  
  97.   // Esperar a que el usuario presione "Enter" para salir
  98.   system("PAUSE");
  99.  
  100.   return 0;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement