Está en la página 1de 25

#include <iomanip> #include <conio.h> #include<iostream> #include<math.

h> #include <string>

//setw

using namespace std; // DECLARACION DE VARIABLES PUBLICAS int a, b,c,discri; double x1,x2; double PI=3.1416; int x,y,R,r; int main() { //DECLARACION de VARIABLES int opcion; //ASIGNACION cout << "HUAMANI JULIAN OLIVER // 2 CICLO // "<<"I-M3"<<endl<<endl; cout << "*************** MENU ************** "<<endl<<endl; cout << "1) ECUACION DE SEGUNDO GRADO"<<endl; cout << "2) PRODUCTO DE DOS NUMEROS"<<endl;

cout << "3) CALCULA EL VOLUMEN DE LA PIRAMIDE "<<endl; cout << "4) CALCULAR ENERGIA CINETICA"<<endl; cout << "5) EL AREA DEL TRIANGULO "<<endl; cout << "6) EL VOLUMEN DEL CILINDRO "<<endl; cout << "7) AREA DE UNA CORONA CIRCULAR "<<endl; cout << "8) AREA DE UN SECTOR CIRCULAR "<<endl; cout << "9) AREA DE UN TRAPECIO CIRCULAR "<<endl; cout << "10) CALCULO DEL ESFUERZO "<<endl<<endl; cout << "******** ESCOJA UNA OPCION ************** "<<endl; // ASIGNACION DE LA VARIABLE cin>> opcion; cout<<endl; //RESULTADO

switch (opcion) {

case 1: // ECUACION DE SEGUNDO GRADO { cout << " ECUACION DE SEGUNDO GRADO \n\n"; cout<<"INGRESE LA CONSTANTE A= ";cin>> a; cout<<endl; cout<<"INGRESE LA CONSTANTE B= ";cin>> b; cout<<endl;

cout<<"INGRESE LA CONSTANTE C= ";cin>> c; cout<<endl; discri = b*b -4*a*c;

if (a!=0) { if (discri>0) { x1 = (-b-sqrt(discri))/2*a; x2 = (-b+sqrt(discri))/2*a;

cout<<"PRIMERA SOLUCION X1= ";cout<< x1; cout<<endl; cout<<"SEGUNDA SOLUCION X2= ";cout<< x2; cout<<endl; } else { cout<<"Solucin indeterminada "; cout<<endl; } } else { cout<<"No tiene Solucin"; cout<<endl;

break; }

case 2:// {

float n1=0.0,n2=0.0,p=0.0;

//FIN DEL PROGRAMA cout<<setw(50)<<"PRODUCTO DE DOS NUMEROS\n" <<setw(50)<<"=======================\n" <<"\n\n\n";

//CONFIGURACION DE DECIMALES cout.setf(ios::fixed); cout.precision(2);

//PROCESO DE LECTURA cout<<setw(30)<<"NUMERO 1 = ";cin>>n1; cout<<setw(30)<<"NUMERO 2 = ";cin>>n2;

//PROCESO DEL CALCULO p=n1/n2;

//PROCESO DE SALIDA cout<<setw(30)<<"PRODUCTO ="<<p<<endl; getch(); break; }//FIN DEL PROGRAMA

case 3: { double vp,n,m,k,D,F,J; string mensaje; mensaje = "*********CALCULA EL VOLUMEN DE LA PIRAMIDE********"; cout<<mensaje<<endl; mensaje ="ingrese variable x: "; cout<<mensaje<<endl; cin>>x; mensaje ="ingrese variable n: "; cout<<mensaje<<endl;

cin>>n; mensaje ="ingrese variable m: "; cout<<mensaje<<endl; cin>>m; mensaje ="ingrese variable k: "; cout<<mensaje<<endl; cin>>k;

D=x+n; F=n-x; J=m-k; vp = 2*D*F*J*J;

cout<<" el volumen es : "<<vp<<endl;

break; case 4: {

//DECLARACION DE VARIABLES float M=0.0,V=0.0,ec=0.0;

//FIN DEL PROGRAMA cout<<setw(50)<<"LA ENERGIA CINETICA ES\n" <<setw(50)<<"======================\n" <<"\n\n\n";

//CONFIGURACION DE DECIMALES cout.setf(ios::fixed); cout.precision(2);

//PROCESO DE LECTURA cout<<setw(30)<<"MASA = ";cin>>M; cout<<setw(30)<<"VELOCIDAD = ";cin>>V;

//PROCESO DEL CALCULO ec=1.0/2*M*(V*V);

//PROCESO DE SALIDA cout<<setw(30)<<"ENERGIA CINETICA ="<<ec<<endl; getch();

break; } case 5: { cout << " AREA DEL TRIANGULO \n"; cout << " ***************************** \n"; //variables privadas float b1,h,AT; //instrucciones

cout<<"Este programa calcula el rea de un triangulo"<<endl; //enter cout<<"Digite el valor de la base"; cin>>b1; cout<<"Digite el valor de la altura"; cin>>h; //proceso AT=(b1*h)/2; cout<<"El rea del Triangulo es"<<AT; getch(); return(0); break; }

case 6: { int r,h; double V; string mensaje;

mensaje = "*********el volumen del cilindro********"; cout<<mensaje<<endl; mensaje ="ingrese radio : "; cout<<mensaje<<endl; cin>>r; mensaje ="ingrese la altura : "; cout<<mensaje<<endl; cin>>h;

V= PI * r*h; cout<<"la longitud es : "<<V<<endl; break; }

case 7: { int r,R; double Acc; string mensaje;

mensaje = "*********AREA DE UNA CORONA CIRCULAR********"; cout<<mensaje<<endl; mensaje ="ingrese radio : "; cout<<mensaje<<endl; cin>>r; mensaje ="ingrese R : "; cout<<mensaje<<endl; cin>>R;

Acc=PI * (R*R - r*r); cout<<"el area de la corona circular es : "<<Acc<<endl; break; }

case 8: { int x,y,R; double Asc; string mensaje;

mensaje = "*********AREA de un sector circular********"; cout<<mensaje<<endl;

mensaje ="ingrese R : "; cout<<mensaje<<endl; cin>>R; mensaje ="ingrese variable x : "; cout<<mensaje<<endl; cin>>x; mensaje ="ingrese variable y: "; cout<<mensaje<<endl; cin>>y; Asc=(PI * R * R * x)/y;

cout<<"el area del sector circular es : "<<Asc<<endl; break; }

case 9:

double ATc; string mensaje;

mensaje = "*********AREA de un TRAPECIO circular********"; cout<<mensaje<<endl;

mensaje ="ingrese R : "; cout<<mensaje<<endl; cin>>R; mensaje ="ingrese radio : "; cout<<mensaje<<endl; cin>>r; mensaje ="ingrese variable x : ";

cout<<mensaje<<endl; cin>>x; mensaje ="ingrese variable y: "; cout<<mensaje<<endl; cin>>y; ATc= (PI * (R*R - r*r)*x)/y; cout<<"el area del sector circular es : "<<ATc<<endl; break; }

case 10: { int A,P; double E; string mensaje;

mensaje = "*********CALCULO DEL ESFUERZO********"; cout<<mensaje<<endl; mensaje ="ingrese LA FUERZA AXIAL: "; cout<<mensaje<<endl; cin>>P; mensaje ="ingrese AREA DE LA SECCION TRANSVERSAL: ";

cout<<mensaje<<endl; cin>>A; E=P/A; cout<<"el ESFUERZO es : "<<E<<endl; break; } //OTHERWISE default: cout << "GRACIAS POR SU VISITA\n"; } system("pause");

También podría gustarte