/* Se ingresan los siguientes datos de personas de una comunidad:
G�nero (M o F).
Talla de polo (S-Peque�o, M-Medio, L-Largo, XL-Extra Largo).
Usa Lentes (S: Si, N: No).
Celular (S: Si, N: No).
Edad.
*/
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
//Declaraci�n de Variables
char Genero,Lentes,Celular,Continuar;
string Talla;
int
Edad,Opcion,MujeresM=0,HombresXL=0,MujeresLentes=0,HombresCelular=0,MujeresCelular=
0,CelularLentes=0;
float EdadMujeres=0,EdadHombres=0,PromM,PromH;
//Menu Principal
do
{
do
{
cout<<"\t\tMENU PRINCIPAL"<<endl;
cout<<"\t\t==== ========="<<endl<<endl;
cout<<"1. Registro de datos."<<endl;
cout<<"2. Reporte de Registros."<<endl;
cout<<"3. Salir."<<endl;
cout<<endl<<"Seleccione una opcion: ";
cin>>Opcion;
cout<<endl;
if ((Opcion==1) || (Opcion==2) || (Opcion==3))
{
switch (Opcion)
{
case 1:
cout<<endl<<"BIENVENIDO - REGISTRE LOS DATOS
SOLICITADOS..."<<endl<<endl;
//Entrada de Datos
do
{
cout<<"\nIngrese genero (M/F): ";
cin>>Genero;
if ((Genero!='M') && (Genero!='m') &&
(Genero!='F') && (Genero!='f'))
{
cout<<endl<<"Genero incorrecto,
intentelo de nuevo."<<endl;
}
This study source was downloaded by 100000835709357 from [Link] on 11-09-2022 [Link] GMT -06:00
[Link]
} while ((Genero!='M') && (Genero!='m') &&
(Genero!= 'F') && (Genero!='f'));
do
{
cout<<"\nIngrese talla de polo (S, M, L,
XL): ";
cin>>Talla;
if ((Talla!="S")&&(Talla!="M")&&(Talla!
="L")&&(Talla!="XL")&&(Talla!="s")&&(Talla!="m")&&(Talla!="l")&&(Talla!="xl"))
{
cout<<endl<<"Talla incorrecta,
intentelo de nuevo."<<endl;
}
} while ((Talla!="S")&&(Talla!="M")&&(Talla!
="L")&&(Talla!="XL")&&(Talla!="s")&&(Talla!="m")&&(Talla!="l")&&(Talla!="xl"));
do
{
cout<<"\n�Usa lentes? (S/N): ";
cin>>Lentes;
if ((Lentes!='S') && (Lentes!='N') &&
(Lentes!='s') && (Lentes!='n'))
{
cout<<endl<<"Genero incorrecto,
intentelo de nuevo."<<endl;
}
} while ((Lentes!='S') && (Lentes!='N') &&
(Lentes!='s') && (Lentes!='n'));
do
{
cout<<"\n�Cuenta con un celular? (S/N):
";
cin>>Celular;
if ((Celular!='S') && (Celular!='N') &&
(Celular!='s') && (Celular!='n'))
{
cout<<endl<<"Genero incorrecto,
intentelo de nuevo."<<endl;
}
} while ((Celular!='S') && (Celular!='N') &&
(Celular!='s') && (Celular!='n'));
do
{
cout<<"\nIngrese su edad: ";
cin>>Edad;
if ((Edad<0) || (Edad>100))
{
cout<<endl<<"La edad ingresada no
This study source was downloaded by 100000835709357 from [Link] on 11-09-2022 [Link] GMT -06:00
[Link]
se encuentra en el rango [0 - 100]."<<endl;
}
} while ((Edad<0) || (Edad>100));
//Proceso
if (((Genero=='F') || (Genero=='f')) &&
((Talla=="M") || (Talla=="m")))
{
MujeresM++;
}
if (((Genero=='M') || (Genero=='m')) &&
((Talla=="XL") || (Talla=="xl")))
{
HombresXL++;
}
if (((Genero=='F') || (Genero=='f')) &&
((Lentes=='S') || (Lentes=='s')))
{
MujeresLentes++;
EdadMujeres+=Edad;
}
if (((Genero=='M') || (Genero=='m')) &&
((Celular=='S') || (Celular=='s')))
{
HombresCelular++;
EdadHombres+=Edad;
}
if (((Genero=='F') || (Genero=='f')) &&
((Celular=='N') || (Celular=='n')))
{
MujeresCelular++;
}
if (((Celular=='S') || (Celular=='s')) &&
((Lentes=='S') || (Lentes=='s')))
{
CelularLentes++;
}
if (MujeresLentes==0 || HombresCelular==0)
{
PromM=0;
PromH=0;
}
else
{
PromM = EdadMujeres / MujeresLentes;
PromH = EdadHombres / HombresCelular;
}
break;
case 2:
//Salida de Datos
cout<<endl<<"RESUMEN DE REPORTES DE
VENTAS..."<<endl<<endl;
cout<<"\nNumero de mujeres con talla M:
This study source was downloaded by 100000835709357 from [Link] on 11-09-2022 [Link] GMT -06:00
[Link]
"<<MujeresM<<" y hombres con talla XL: "<<HombresXL<<endl;
cout<<"\nNumero de mujeres con lentes:
"<<MujeresLentes<<endl;
cout<<"\nNumero de hombres con celulares:
"<<HombresCelular<<endl;
cout<<"\nNumero de mujeres sin celulares:
"<<MujeresCelular<<endl;
cout<<"\nNumero de personas que usan celulares
y lentes: "<<CelularLentes<<endl;
cout<<"\nEdad promedio de las mujeres que usan
lentes: "<<round(PromM)<<endl;
cout<<"\nEdad promedio de los hombres con
celulares: "<<round(PromH)<<endl;
break;
}
}
else
{
cout<<"La opcion seleccionada no es correcta. Vuelva a
intentarlo."<<endl<<endl;
}
cout<<endl<<endl<<"�Volver al menu? (Y/N): ";
cin>>Continuar;
cout<<endl<<endl;
} while ((Opcion<1) || (Opcion>3));
} while ((Continuar=='Y') || (Continuar=='y'));
if (Continuar!='Y' || Continuar!='y')
{
cout<<endl<<"Gracias. Vuelva pronto."<<endl;
}
return 0;
}
This study source was downloaded by 100000835709357 from [Link] on 11-09-2022 [Link] GMT -06:00
[Link]
Powered by TCPDF ([Link])