Created
November 24, 2016 17:01
-
-
Save humbertowoody/45efe93f9f078c05a868e53acc64394a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Para poder leer. | |
import java.util.Scanner; | |
// Clase principal | |
public class Funciones | |
{ | |
// Pa' leer las cosas en tooodas las funciones y no tener que reescribir. | |
public static Scanner usuario = new Scanner(System.in); | |
/* | |
FUNCIONES. | |
Aqui van tus ochorrosientas mil funciones. | |
*/ | |
public static void funcion1(){ | |
int num1, num2; | |
System.out.print("Primer numero: "); | |
num1 = usuario.nextInt(); | |
System.out.print("\nSegundo: "); | |
num2 = usuario.nextInt(); | |
System.out.println("El resultado es: "+(num1+num2)+"."); | |
} | |
public static void funcion2(){ | |
System.out.println("aosdijfaoisdfj"); | |
} | |
// etc | |
/* | |
Funcion principal. | |
O sea, menu chiquito bebe | |
*/ | |
public static void main(String[] args) | |
{ | |
int opcion = 0; | |
do{ | |
System.out.println("Elije una opcion prro :v\n"); | |
System.out.print("1- bla. \n 2- bla2\n"); | |
opcion = usuario.nextInt(); | |
switch(opcion) | |
{ | |
case 1: | |
funcion1(); | |
break; | |
case 2: | |
funcion2(); | |
break; | |
default: | |
break; | |
} | |
}while(opcion != 0); | |
System.out.println("BYE"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment