LAB 2

//LAB 2

//Dev -C++
//PRESIONES EN EL SISTEMA HIDRAULICO

#include<iostream>
#include<math.h>
using namespace std;

int i,j,P;
int Presion[10],min,max ,suma;

int main()
{

 int opcion;
 do
{
cout<<"\n ****************** MENU PRINCIPAL *********************** \n\n";
cout<<"1) PRESIONES EN EL SISTEMA \n ";
cout<<"2) IMPRESION DE LAS PRESIONES EN EL SISTEMA\n ";
cout<<"3) PRESION MAXIMA \n ";
cout<<"4) PRESION  MINIMA \n ";
cout<<"5) SUMA DE PRESIONES \n ";
cout<<"6) CONTAR CUANTAS VECES SE REPITE CADA PRESION \n\n ";
cout<<"*********************************************************\n\n";
cout<<"      Ingrese una opcion: ";  cin>>opcion;


switch (opcion)
{

case 1:
{
cout<<"\n ************** PRESIONES EN EL SISTEMA **************\n\n";
for (i=1;i<=10;i++)
{
cout<<" INGRESE LAS PRESIONES EN EL SISTEMA P["<<i<<"]= ";cin>> Presion[i];
}
cout<<endl;
cout<<" ********************************************************* \n\n";
}//FIN DEL CASO 1
break;


case 2:
{
cout<<"\n ****** IMPRESION DE LAS PRESIONES EN EL SISTEMA******\n\n";
for (i=1;i<=10;i++)
{
cout<<" LA PRESION P["<<i<<"] : "<< Presion[i]<<endl;
}
cout<<endl;
cout<<" ********************************************************* \n\n";
}//FIN DEL CASO 2
break;

case 3:
{  
cout<<"\n ********************* PRESION MAXIMA *******************\n\n";
int max=0;
for (i=1;i<=10;i++)
{
if(Presion[i]>max)
max = Presion[i];
}
cout<<" EL MAXIMO ES : "<<max;
cout<<endl;
cout<<"\n ********************************************************* \n\n";
}//FIN DEL CASO 3
break;



case 4:
{  
cout<<"\n ******************** PRESION  MINIMA ********************\n\n";
int min=100;
for (i=1;i<=10;i++)
{
if(Presion[i]<min)
min = Presion[i];
}
cout<<" EL MINIMO ES : "<<min;
cout<<endl;
cout<<"\n ********************************************************* \n\n";
}//FIN DEL CASO 4
break;

case 5:
{
cout<<"\n ***************** SUMA DE LONGITUDES ********************\n";
int suma =0;
for(i=0;i<=10;i++)
suma=suma+Presion[i];
cout<<" \n ----------------------------------------\n";
cout<<"\n LA SUMA DE PRESIONES ES:"<<suma<<endl;
cout<<endl;
cout<<"\n ********************************************************* \n\n";
}//FIN DEL CASO 5
break;

  case 6:
{  
cout<<"\n ******* CONTAR VECES QUE SE REPITE CADA PRESION ********\n\n";
for(i=1;i<=10;i++)
{
P=0;
for (j=1;j<=10;j++)
{        
if(Presion[i]==Presion[j])
{
P=P+1;
}
}
cout<< " EL VALOR "<<Presion[i]<<" SE REPITE : "<<P<<"VECES"<<endl;
}
cout<<endl;
cout<<"\n ********************************************************* \n\n";
cout<<endl;
}//FIN DEL CASO 6
break;

} // FIN DEL SWITCH
}
while (opcion !=0);

cout<<endl; cout<<"\n";
 system("pause");
 return 0;
} // FIN DEL PROGRAMA

No hay comentarios.:

Publicar un comentario