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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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!