Dev - C++ - Qatar

 
Vista:

Qatar

Publicado por Andy (1 intervención) el 15/04/2024 06:49:25
#include <iostream>
#include <ctime>

using namespace std;

int main ()
{
//Inicializamos variables
int precio = 0 ,nboletos = 0;
char tipo;
int OK = 1,x= 0, y=0;

/*Despliega tiempo de ejecucion en pantalla*/
time_t tiempo = time(0);
tm *tlocal = localtime(&tiempo);
char output[128];
strftime(output,128,"%d/%m/%y %H:%M:%S",tlocal);

/*Despliega mensaje de bienvenido*/
cout<<"\n \t********************************************"<<endl;
cout<<"\t BIENVENIDOS AL CURSO FUNDAMENTOS DE PROGRAMACION\n"<<endl;
cout<<"\t ENTREGABLE 2"<<endl;
cout<<"\t ********************************************"<<endl;
cout<<"\t BIENVENIDO AL MUNDIAL Q@TAR 2022"<<endl;
cout<<"\t ********************************************"<<endl;
cout<<"\n \t USUARIO : Andy Abdiel Rodriguez Echeverria \t"<<output<<endl;
cout<<"\t ********************************************"<<endl;
cout<<"\t ESTADIO Q @ T A R 2022 ***"<<endl;
cout<<"\t ********************************************"<<endl;
cout<<"\t Sector ***Precio***"<<endl;
cout<<"\t ********************************************"<<endl;
cout<<"\t A. VIP $1400 \n"<<endl;
cout<<"\t B. ZONA VERDE $1200 \n"<<endl;
cout<<"\t C. ZONA AMARILL $850 \n"<<endl;
cout<<"\t D. ZONA NARANJA $650 \n"<<endl;
cout<<"\t E. ZONA ROJA $250 \n"<<endl;
cout<<"\t ********************************************"<<endl;
cout<<"Ingrese el sector: A,B,C,D,E?\t";
cin>> tipo;

if (tipo == 'A')
{
precio = 1400;
cout<<"Tipo A -> Sector seleccionado: VIP"<<endl;
}
else if (tipo == 'B')
{
precio = 1200;
cout<<"Tipo B -> Sector seleccionado: ZONA VERDE"<<endl;
}
else if (tipo == 'C')
{
precio = 850;
cout<<"Tipo C -> Sector seleccionado: ZONA AMARILLA"<<endl;
}
else if (tipo == 'D')
{
precio = 650;
cout<<"Tipo D -> Sector seleccionado:ZONA NARANJA"<<endl;
}
else if (tipo == 'E')
{
precio = 250;
cout<<"Tipo E -> Sector seleccionado:ZONA ROJA"<<endl;
}
else
{
OK = 0;
}

// Si es un sector válido
if (OK == 1)
{
cout<<"\n Ingrese la cantidad de boletos a comprar: ";
cin>> nboletos;
x = nboletos * precio;
cout<<"\n Precio unitario:"<< endl << precio << endl;
cout<<"\n Cantidad de Entradas:"<< endl << nboletos << endl;
cout<<"\n Total a pagar: " << endl << x << endl;
y = x * .90;
cout<<"\n ¡Total a pagar con un 10% de descuento!" <<endl <<y <<endl;
}
else
{
cout<<" El sector seleccionado no existe, Favor de verificar. "<<endl;
}
return 0;
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de kevin

Qatar

Publicado por kevin (60 intervenciones) el 07/05/2024 02:28:20
¿Cuál es tu petición con este código?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar