06.05.2013 Views

CONTENIDO DE LA LECCIÓN 18

CONTENIDO DE LA LECCIÓN 18

CONTENIDO DE LA LECCIÓN 18

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MIGUEL Á. TOLEDO MARTÍNEZ<br />

Ejemplo <strong>18</strong>.14<br />

Nuestro siguiente programa, HISTOGRAMA.CPP, lee los números de un arreglo llamado arreglo y traza<br />

la información en forma de un gráfico de barras o histograma; cada número se imprime, seguido de una<br />

barra consistente en la misma cantidad de asteriscos.<br />

/* El siguiente programa: HISTOGRAMA.CPP, imprime un histograma. */<br />

#include //Para cout y cin<br />

#include //Para setw()<br />

void main(void)<br />

{<br />

}//Fin de main()<br />

Ejemplo <strong>18</strong>.15<br />

// Ahora obtiene el promedio<br />

double suma = 0;<br />

for (int ix = 0; ix < numeroElementos; ++ix)<br />

suma += arreglo[ix];<br />

cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!