Вы находитесь на странице: 1из 8

#include<stdio.

h>

#include<conio.h>

void main()

char publico,infraccion,familiar,rpta;

int n,tipo,monto,totalsp,totalsf,totalmale,totalpalu,totalfama;

int malest=0,cmalest=0,palu=0,cpalu=0,fama=0,cfama=0,contc=0;

int malest1=0,cmalest1=0,palu1=0,cpalu1=0,fama1=0,cfama1=0,conto=0;

int malest2=0,cmalest2=0,palu2=0,cpalu2=0,fama2=0,cfama2=0,contt=0;

int malest3=0,cmalest3=0,palu3=0,cpalu3=0,fama3=0,cfama3=0,contp=0;

int cantc,canto,cantt,cantp;

printf("\n ingresar el numero de cantidad mas conveniente:");

scanf("%d",&n);

for(int i=1;i<=n;i++){

fflush(stdin);

printf("\n ingresar tipo de unidad movil:(1)serviciopublico,(2)serviciofamiliar");

scanf("%d",&tipo);

switch(tipo){

case 1:

fflush(stdin);

printf("\n ingresar tipo de servicio publico:(C)colectivo,(O)omnibus");

scanf("%c",&publico);

switch(publico){

case 'C':

case 'c':

do{

fflush(stdin);

printf("\n ingresar tipo de infraccion:(M)malestacionamiento,(P)pasarseluzroja,(F)farosmalogrados");

scanf("%c",&infraccion);

fflush(stdin);
printf("\n ingrsar monto:");

scanf("%d",&monto);

switch(infraccion){

case 'M':

case 'm':

malest=malest+monto;

cmalest=cmalest+1;

break;

case 'P':

case 'p':

palu=palu+monto;

cpalu=cpalu+1;

break;

case 'F':

case 'f':

fama=fama+monto;

cfama=cfama+1;

break;

default:

printf("\n error de infraccion");

fflush(stdin);

printf("desea continuar con la infraccion s/n:");

scanf("%c",&rpta);

}while(rpta=='s'||rpta=='S');

contc=contc+1;

break;

case 'O':

case 'o':

do{
fflush(stdin);

printf("\n ingresar tipo de infraccion:(M)malestacionamiento,(P)pasarseluzroja,(F)farosmalogrados");

scanf("%c",&infraccion);

fflush(stdin);

printf("\n ingrsar monto:");

scanf("%d",&monto);

switch(infraccion){

case 'M':

case 'm':

malest1=malest1+monto;

cmalest1=cmalest1+1;

break;

case 'P':

case 'p':

palu1=palu1+monto;

cpalu1=cpalu1+1;

break;

case 'F':

case 'f':

fama1=fama1+monto;

cfama1=cfama1+1;

break;

default:

printf("\n error de infraccion");

fflush(stdin);

printf("desea continuar con la infraccion s/n:");

scanf("%c",&rpta);

}while(rpta=='s'||rpta=='S');

conto=conto+1;
break;

default:

printf("\n error de servicio publico");

}break;

case 2:

fflush(stdin);

printf("\n ingresar tipo de servicio familiar:(T)taxi,(P)movilidadpropia");

scanf("%c",&familiar);

switch(familiar){

case 'T':

case 't':

do{

fflush(stdin);

printf("\n ingresar tipo de infraccion:(M)malestacionamiento,(P)pasarseluzroja,(F)farosmalogrados");

scanf("%c",&infraccion);

fflush(stdin);

printf("\n ingrsar monto:");

scanf("%d",&monto);

switch(infraccion){

case 'M':

case 'm':

malest2=malest2+monto;

cmalest2=cmalest2+1;

break;

case 'P':

case 'p':

palu2=palu2+monto;

cpalu2=cpalu2+1;

break;

case 'F':
case 'f':

fama2=fama2+monto;

cfama2=cfama2+1;

break;

default:

printf("\n error de infraccion");

fflush(stdin);

printf("desea continuar con la infraccion s/n:");

scanf("%c",&rpta);

}while(rpta=='s'||rpta=='S');

contt=contt+1;

break;

case'P':

case'p':

do{

fflush(stdin);

printf("\n ingresar tipo de infraccion:(M)malestacionamiento,(P)pasarseluzroja,(F)farosmalogrados");

scanf("%c",&infraccion);

fflush(stdin);

printf("\n ingrsar monto:");

scanf("%d",&monto);

switch(infraccion){

case 'M':

case 'm':

malest3=malest3+monto;

cmalest3=cmalest3+1;

break;

case 'P':

case 'p':

palu3=palu3+monto;
cpalu3=cpalu3+1;

break;

case 'F':

case 'f':

fama3=fama3+monto;

cfama3=cfama3+1;

break;

default:

printf("\n error de infraccion");

fflush(stdin);

printf("desea continuar con la infraccion s/n:");

scanf("%c",&rpta);

}while(rpta=='s'||rpta=='S');

contp=contp+1;

break;

default:

printf("\n error de servicio familiar");

}break;

default:

printf("\n error de tipo de servicio");

cantc=cmalest+cpalu+cfama;

canto=cmalest1+cpalu1+cfama1;

cantt=cmalest2+cpalu2+cfama2;

cantp=cmalest3+cpalu3+cfama3;

if(cantc>canto||cantc>cantt||cantc>cantp)

printf("\n la unidad con mayor infraccion es el colectivo");

}
else{

if(canto>cantc||canto>cantt||canto>cantp){

printf("\n la unidad con mayor infraccion es el omnibus");

else{

if(cantt>cantc||cantt>canto||cantt>cantp){

printf("\n la unidad con mayor infraccion es el taxi");

else{

if(cantp>cantc||cantp>canto||cantp>cantt){

printf("\n la unidad con mayor infraccion es la movilidad propia");

totalsp=contc+conto;

totalsf=contt+contp;

totalmale=malest+malest1+malest2+malest3;

totalpalu=palu+palu1+palu2+palu3;

totalfama=fama+fama1+fama2+fama3;

printf("\n el total de unidades del servicio publico es:%d",totalsp);

printf("\n el total de unidades del servicio familiar es:%d",totalsf);

printf("\n monto total de mal estacionamiento es:%d",totalmale);

printf("\n monto total de pasar la luz roja es:%d",totalpalu);

printf("\n monto total de faro malogrado es:%d",totalfama);

getch();

Вам также может понравиться