Hola Mundo

a guest Aug 19th, 2019 125 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream> //input output stream  (C++): incluye cout
  2. #include <conio.h>  //console input output (C)  : incluye getch
  3. //using namespace std;
  5. int main() {
  6.     //cout: console out
  7.     //endl: end line
  8.     std::cout << "Hola Mundo!" << std::endl;
  9.     //get character (pausa hasta que se capture un caracter, retorna el valor de la tecla - caracter - presionada)
  10.     //y le asigna el valor a la variable "tecla" de tipo "char"
  11.     char tecla = getch();
  12.     //Si es que la el valor guardado en la variable "tecla" es 'a'
  13.     //entonces entrará a la línea 15 del código, sino saltará a la 16
  14.     if(tecla=='a')
  15.         std::cout << "Adios mundo cruel!" << std::endl;
  16.     getch();
  17.     return 0;
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand