Advertisement
iamoran

Case para juegos

Aug 26th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. //using namespace std; //i dont know why this is  necessary  
  4.  
  5.  
  6. int main ()
  7. {
  8.     int opcion, salir=0; //opcion
  9.         while ( salir == 0 )
  10.         {
  11.            
  12.             printf("Escoge una opcion:\n");
  13.             printf("Entrar al juego: 1\n");
  14.             printf("Entrar al juego: 2\n");
  15.             printf("Salir: 3\n");
  16.            
  17.             scanf("%d", &opcion); //recibo la opcion
  18.            
  19.                 switch (opcion)
  20.                 {
  21.                         case 1:
  22.                             printf("Entraste al juego 1:\n");
  23.                         break;
  24.                        
  25.                         case 2:
  26.                             printf("Bienvenido al juego 2:\n");
  27.                         break;        
  28.                        case 3:
  29.                             printf("Salir:\n");
  30.                             salir = opcion;
  31.                         break;
  32.                         default:
  33.                             printf("Opcion incorrecta:\n");
  34.                         break;
  35.                
  36.                 }
  37.             fflush(stdin);
  38.             getchar();
  39.         }    
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement