
22/06/2012, 09:07
|
 | | | Fecha de Ingreso: mayo-2012 Ubicación: Programing Cloud
Mensajes: 282
Antigüedad: 12 años, 10 meses Puntos: 28 | |
Respuesta: pekeño programa en c++ si te sirve dale Like!!!
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
using namespace std;
int notas[40] = {3,3,4,5,6,7,8,9,8,4,5,6,7,8,9,2,3,4,5,6,7,8,9,3,4 ,5,6,7,8,89,8,5,6,7,8,89,8,5,6,7};
inline double Media() {
int sum = 0;
for (int i =0; i < 40; i++)
sum += notas[i];
return (double)sum/40.0;
}
inline int MasBaja() {
int min = 9999;
for (int i =0; i < 40; i++)
if ( notas[i] < min )
min = notas[i];
return min;
}
inline int MasAlta() {
int max = 0;
for (int i =0; i < 40; i++)
if ( notas[i] > max )
max = notas[i];
return max;
}
int main () {
char tecla;
cin>>tecla;
if ( tecla == 'M' ) cout<< Media() <<endl;
else if ( tecla == 'A' ) cout<< MasAlta() <<endl;
else if (tecla == 'B') cout<< MasBaja() <<endl;
system("pause");
}
s2
crono |