jueves, 27 de abril de 2017

MENÚ


MENÚ

Menú se puede utilizar para que en la programación existan diferentes opciones a elegir.

//Muestra como hacer un menú simple con las estructuras Repetir-Hasta Que y Según

subproceso suma(N)
// Anthony Carrasco - Mary Nicolalde
Definir N1, N2 como Real
Escribir 'Ingrese primer numero'
Leer N1
Escribir 'Ingrese segundo numero'
Leer N2
R1<-(N1+N2)
Limpiar Pantalla
Escribir '----------------------------------------'
Escribir 'La suma es:' R1
Escribir '----------------------------------------'
Escribir 'Dar ENTER'
Esperar Tecla
FinSubProceso
subproceso resta(N)
Definir N1, N2 como Real
Escribir 'Ingrese primer numero'
Leer N1
Escribir 'Ingrese segundo numero'
Leer N2
R1<-(N1-N2)
Limpiar Pantalla
Escribir '----------------------------------------'
Escribir 'La resta es:' R1
Escribir '----------------------------------------'
Escribir 'Dar ENTER'
Esperar Tecla
FinSubProceso
subproceso multi(N)
Definir N1, N2 como Real
Escribir 'Ingrese primer numero'
Leer N1
Escribir 'Ingrese segundo numero'
Leer N2
R1<-(N1*N2)
Limpiar Pantalla
Escribir '----------------------------------------'
Escribir 'La multiplicacion es:' R1
Escribir '----------------------------------------'
Escribir 'Dar ENTER'
Esperar Tecla
FinSubProceso
subproceso division(N)
Definir N1, N2 como Real
Escribir 'Ingrese primer numero'
Leer N1
Escribir 'Ingrese segundo numero'
Leer N2
R1<-(N1/N2)
Limpiar Pantalla
Escribir '----------------------------------------'
Escribir 'La division es:' R1
Escribir '----------------------------------------'
Escribir 'Dar ENTER'
Esperar Tecla
FinSubProceso
subproceso finn(N)
Escribir '¡Gracias por su visita! :v'
FinSubProceso
subproceso menu(N)
Definir opc, R1 Como Entero
Repetir
Limpiar Pantalla
Escribir 'Menu operaciones básicas (calculator :v)'
Escribir '----------------------------------------'
Escribir '1._Suma'
Escribir '2._Resta'
Escribir '3._Multiplicación'
Escribir '4._División'
Escribir '5._FIN'
Escribir '----------------------------------------'
Escribir 'Eija una opción del 1 al 5'
Leer opc
Segun opc hacer
1: suma(N)
2: resta(N)
3: multi(N)
4: division(N)
5: finn(N)
FinSegun
Hasta Que opc=5
FinSubProceso
Algoritmo ste_calculator
Definir N Como Entero
Escribir 'Ingrese el numero'
Leer N
menu(N)
FinAlgoritmo

No hay comentarios:

Publicar un comentario