ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Pizzeria


Enviado por   •  1 de Octubre de 2015  •  Tareas  •  698 Palabras (3 Páginas)  •  102 Visitas

Página 1 de 3

Pizzas en c++

  1. #include
  2. using namespace std;
  3.  
  4. int main (){
  5.    
  6.     int bucle = 1;
  7.     int tipo = 0;
  8.     int consinextra = 0;
  9.     int total = 0;
  10.     int pizzaqueso = 5; //poner aqui el precio la pizza de queso.
  11.     int pizzaatum = 5; //poner aqui el precio la pizza de atum.
  12.     int extra = 2; //poner aqui precio de los extras
  13.  
  14.     cout << "cual el la pizza, 1 o 2?" << endl;
  15.     cin>>tipo;
  16.    
  17.     while ( bucle ){
  18.          
  19.           switch ( tipo ){
  20.                  
  21.              case 1:
  22.                 total += pizzaqueso;
  23.                 cout << "Le gustaria añadir extras? por " << extra << " euros mas";
  24.                 cout << endl;
  25.                 cout <<"1 si\n" << "2 no" << endl;
  26.                 cout << endl;
  27.                 cin>>consinextra;      
  28.                 if ( consinextra == 1)
  29.                    total = total + extra;
  30.                    break;
  31.                 if ( consinextra == 2)
  32.                    break;
  33.                    
  34.               case 2:
  35.                  cout << "lo haces tu la de atum XD" << endl;
  36.              default:
  37.                 break;    
  38.           }
  39.          
  40.           cout << "Total: " << total << " euros." << endl;
  41.           cout << "Quiere seguir comprando mas?" << endl;
  42.           cout << "1 si\n" << "2 no" << endl;
  43.           cin>>bucle;
  44.          
  45.           if ( bucle == 0 )
  46.              bucle = 1;
  47.           if ( bucle == 2 )
  48.              break;
  49.     }

}

...

Descargar como (para miembros actualizados)  txt (1.6 Kb)   pdf (65.6 Kb)   docx (10.9 Kb)  
Leer 2 páginas más »
Disponible sólo en Clubensayos.com