funciones 2 (revisar)

Download Funciones 2 (revisar)

If you can't read please download the document

Upload: jmlg216

Post on 28-Sep-2015

220 views

Category:

Documents


3 download

DESCRIPTION

erwrer trtrtr

TRANSCRIPT

/*Una ciudad de n habitantes desea calcular el promedio de pesos estaturas y edadesde los habitantes de dicha ciudad separados por sexo. Construya un programa queen funciones calcule lo pedido, y en una funcion de impresion imprima los promedios*/#include#includefloat calp(int,float,float,float);void imp(float);void main(){ int nhabi,sw,nh=0,nm=0,sexo; float peso,est,edad,sph=0,spm=0,sesth=0,sestm=0,sedh=0,sedm=0; coutnhabi; while(nhabi>0) { coutsexo; coutpeso>>est>>edad; switch(sexo) { case 1: nh++; sph+=peso; sedh+=edad; sesth+=est; break; case 2: nm++; spm+=peso; sedm+=edad; sestm+=est; break; } nhab--; } prom=calp(int nh,float sph, float sesth, float sedh); imp(prom)}