Skip to content

Instantly share code, notes, and snippets.

@ahoulgrave
Created June 4, 2013 17:21
Show Gist options
  • Save ahoulgrave/5707791 to your computer and use it in GitHub Desktop.
Save ahoulgrave/5707791 to your computer and use it in GitHub Desktop.
Menú de restaurant...
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
int menu;// Categoria del menu
int opcion;// Opcion (Compra, Pago, Salir)
int item;// Item a comprar
float total;// Total de la compra
while (opcion != 0) {
printf("Seleccione una opcion:\n");
printf("\n1. Comprar\n");
printf("2. Pagar\n");
printf("0. Salir\n");
scanf("%d", &opcion);
switch(opcion) {
case 1:
while (menu != 0) {
printf("\n\nSeleccione una categoria:\n");
printf("1. Bebidas no alcoholicas \n");
printf("2. Bebidas alcoholicas \n");
printf("3. Pastas \n");
printf("4. Carnes \n");
printf("5. Pescado\n");
printf("6. Postres\n");
printf("0. Salir\n");
scanf("%d",&menu);
switch(menu) {
case 1: printf ("\tBebidas no alcoholicas:\n");
printf ("\t\t1. Gaseosa linea Coca-Cola\t\t$10.00\n");
printf ("\t\t2. Gasosa linea Pepsi\t\t$9.80\n");
printf ("\t\t3. Gasosa linea Manaos\t\t$7.50\n");
printf ("\t\t4. Agua mineral\t\t\t$6.00\n");
printf ("\t\t0. Volver\n\n");
scanf("%d",&item);
switch(item) {
case 1:
total = total+10;
break;
case 2:
total = total+9.8;
break;
case 3:
total = total+7.5;
break;
case 4:
total = total+6;
break;
}
break;
case 2:
printf ("\tBebidas alcoholicas:\n");
printf ("\t\t1. Vodka \t\t$35.40\n");
printf ("\t\t2. Tequila \t\t$40.50 \n");
printf ("\t\t3. Ceverza \t\t$15.00 \n");
printf ("\t\t4. Dr.Lemon\t\t$18.00 \n");
printf ("\t\t0. Volver\n\n");
scanf("%d",&item);
switch(item) {
case 1:
total = total+35.4;
break;
case 2:
total = total+40.5;
break;
case 3:
total = total+15;
break;
case 4:
total = total+18;
break;
}
break;
case 3:
printf ("\tPastas:\n");
printf ("\t\t1. Fideos \t\t$30.75\n");
printf ("\t\t2. Ravioles\t\t$35.80\n");
printf ("\t\t3. Gnoquis \t\t$40.00\n");
printf ("\t\t0. Volver\n\n");
scanf("%d",&item);
switch(item) {
case 1:
total = total+30.75;
break;
case 2:
total = total+35.8;
break;
case 3:
total = total+40;
break;
}
break;
case 4:
printf ("\tCarnes:\n");
printf ("\t\t1. Asado \t\t$40.00\n");
printf ("\t\t2. Vacio \t\t$65.30\n");
printf ("\t\t3. Parrillada\t\t$120.00\n");
printf ("\t\t4. Embutidos \t\t$20.50\n");
printf ("\t\t0. Volver\n\n");
scanf("%d",&item);
switch(item) {
case 1:
total = total+40;
break;
case 2:
total = total+65.3;
break;
case 3:
total = total+120;
break;
case 4:
total = total+20.5;
break;
}
break;
case 5:
printf ("\tPescados:\n");
printf ("\t\t1. Milanesa de pescado\t\t$25.00\n");
printf ("\t\t2. Boga asada \t\t$55.80\n");
printf ("\t\t3. Mariscos \t\t$89.45\n");
printf ("\t\t0. Volver\n\n");
scanf("%d",&item);
switch(item) {
case 1:
total = total+25;
break;
case 2:
total = total+55.8;
break;
case 3:
total = total+89.45;
break;
}
break;
case 6:
printf ("\tPostres:\n");
printf ("\t\t1. Flan con creama/mixto \t\t$35.20\n");
printf ("\t\t2. Budin de pan \t\t$20.00\n");
printf ("\t\t3. Torta de cumpleaños (con cancion incluida)\t\t$150.80\n");
printf ("\t\t0. Volver\n\n");
scanf("%d",&item);
switch(item) {
case 1:
total = total+35.2;
break;
case 2:
total = total+20;
break;
case 3:
total = total+150.8;
break;
}
break;
}// Fin switch categorias
}// Fin while categorias
break;// Fin case Comprar
case 2:
printf ("\nEl total de su compra es: %f\n\nGracias por su compra!",total);
break;
}// Fin switch opciones
}// Fin while opciones
system("PAUSE");
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment