#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
void ingresarNotas (float notas[],int n)
{
int temp=1;
float arreglo;
arreglo=notas[n];
if(n>1)
{
for(int indice=1; indice<=n; indice++)
{
cout<<"Ingresar nota N. "<<temp<<" :"<<endl;
cin>>notas[indice];
temp++;
}
}
else
cout<<"Error!! ingrese una cantidad real de notas..."<<endl;
}
float calcularPromedio(float notas[],int n)
{
float promedio,suma=0;
for (int indice=0;indice<=n;indice++)
suma=suma + notas[indice];
promedio=suma/n;
return (promedio);
}
int notasMayorProm(float notas[],int n)
{
int cantidad=0;
int indice;
indice=0;
while (indice<n)
{
if(calcularPromedio(notas,n)<notas[indice])
cantidad++;
indice++;
}
return(cantidad);
}
int notasMenorProm(float notas[],int n)
{
int cantidad=0;
int indice;
indice=0;
while (indice<=n)
{
if(calcularPromedio(notas,n)>notas[indice])
cantidad++;
indice++;
}
return (cantidad);
}
int notasAprobadas(float notas[],int n)
{
int cantidad=0;
int indice;
indice=0;
while (indice<=n)
{
if(notas[indice]>2.9 && notas[indice]<=5)
cantidad++;
indice++;
}
return (cantidad);
}
int notasReprobadas(float notas[],int n)
{
int cantidad=0;
int indice;
indice=0;
while (indice<=n)
{
if(notas[indice]<2)
cantidad++;
indice++;
}
return (cantidad);
}
int notasHabilitacion(float notas[],int n)
{
int cantidad=0;
int indice;
indice=0;
while (indice<=n)
{
if(notas[indice]>1.9 && notas[indice]<2.95)
cantidad++;
indice++;
}
return (cantidad);
}
int notaMayor(float notas[],int n)
{
int cantidad=0;
int indice;
indice=0;
while (indice<=n)
{
if(notas[indice]>4.9 && notas[indice]<=5)
cantidad++;
indice++;
}
return (cantidad);
}
void notaMasBaja (float notas [], int n)
{
int indice, nBaja, temp=0;
nBaja=notas [0];
for (indice=0;indice<n;indice++)
{
if(notas[indice]<nBaja)
{
nBaja=notas[indice];
temp=indice;
}
}
cout<<"Nota mas baja:"<<nBaja;
cout<<"Cantidad de notas:"<<temp+1<<endl;
}
int notaIgualACinco(float notas[],int n)
{
int cantidad=0;
int indice=1;
while (indice<=n)
{
if(notas[indice]==5)
cantidad++;
indice++;
}
return (cantidad);
}
void incremento08(float notas[],int n)
{
int indice=0;
while(indice<n)
{
if (notas[indice]>=0 && notas[indice]<=0.5)
notas=notas[indice]+0.8;
}
}
void imprimirNotas(float notas [], int n)
{
int indice=0,temp=1;
while(indice<n)
{
cout<<"nota"<<temp<<"="<<notas[indice]<<endl;
temp++;
indice++;
}
}
void ordenamientoBurbujaAscendente(float notas[],int n)
{
float aux;
int ind1,ind2;
for(ind1=0;ind1<n-1;ind1++)
{
for (ind2=0;ind2<n-1;ind2++)
if (notas [ind2]>notas[ind2+1])
{
aux=notas[ind2];
notas[ind2]=notas [ind2+1];
notas [ind2+1]=aux;
}
}
}
void ordenamientoBurbujaDescendente(float notas[],int n)
{
float aux;
int ind1,ind2;
for(ind1=0;ind1>n-1;ind1++)
{
for (ind2=0;ind2>n-1;ind2++)
if (notas [ind2]>notas[ind2+1])
{
aux=notas[ind2];
notas[ind2]=notas [ind2+1];
notas [ind2+1]=aux;
}
}
}
int main (){
system("color fc");
char nombre[32];
int n;
float notas[n];
cout<<"Ingresar nombre completo: ";
cin>>nombre;
cout<<"Ingresar el numero de notas: "<<endl;
cin>>n;
ingresarNotas (notas,n);
float prom=calcularPromedio (notas,n);
cout<<"Valor promedio: "<<prom<<endl;
int cantidad=notasMayorProm(notas,n);
cout<<"Total calificaciones por encima del promedio: "<<cantidad<<endl;
int menor=notasMenorProm(notas,n);
cout<<"Total calificaciones por debajo del promedio: "<<menor<<endl;
int aprobo=notasAprobadas(notas,n);
cout<<"Total calificaciones aprobadas: "<<aprobo<<endl;
int perdio=notasReprobadas(notas,n);
cout<<"Total calficaciones reprobadas: "<<perdio<<endl;
int habilito=notasHabilitacion(notas,n);
cout<<"Calificaciones para habilitacion :"<<habilito<<endl;
int alta=notaMayor(notas,n);
cout<<"Mejor calificacion: "<<alta<<endl;
int cinco=notaIgualACinco(notas,n);
cout<<"Cantidad de notas igual a cinco: "<<cinco<<endl;
notaMasBaja(notas,n);
ordenamientoBurbujaAscendente(notas,n);
ordenamientoBurbujaDescendente(notas,n);
imprimirNotas(notas,n);
getch();
return 0;
}
Ingenieria Ambiental
martes, 26 de junio de 2012
Suscribirse a:
Comentarios (Atom)