Created
May 5, 2016 01:46
-
-
Save alonzoibarra97/c92d87f03187e847f4e66ce2c488a70f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
#include <cmath> | |
using namespace std; | |
void menu_principal(); | |
void menu_sum(); | |
void menu_res(); | |
void menu_mul(); | |
void menu_div(); | |
void menu_pow(); | |
double deltax, x, deltay, y, potencia, incertidumbre; | |
int main() | |
{ | |
menu_principal(); | |
return 0; | |
} | |
void menu_principal() | |
{ | |
bool repite= true; | |
int opcion; | |
do{ | |
system("cls"); | |
cout<< "\n\t Menu principal\n"; | |
cout<< "\n\t1. Suma\n"; | |
cout<< "\n\t2. Resta\n"; | |
cout<< "\n\t3. Multiplicacion\n"; | |
cout<< "\n\t4. División\n"; | |
cout<< "\n\t5. Potencia\n"; | |
cout<< "\n\t0. Salir\n"; | |
cout<< "\n\t Opcion: "; | |
cin>> opcion; | |
switch(opcion) { | |
case 1: | |
menu_sum(); | |
break; | |
case 2: | |
menu_res(); | |
break; | |
case 3: | |
menu_mul(); | |
break; | |
case 4: | |
menu_div(); | |
break; | |
case 5: | |
menu_pow(); | |
break; | |
case 0: | |
repite= false; | |
break; | |
} | |
}while(repite); | |
} | |
void menu_sum() | |
{ | |
bool repite= true; | |
int opcion; | |
do{ | |
system("cls"); | |
cout<<"\n\t Menu Suma\n"; | |
cout<< "\n\t1. Absoluta\n\n"; | |
cout<< "\n\t2. Relativa\n"; | |
cout<< "\n\t0. Salir\n"; | |
cout<< "\n\tOpcion: "; | |
cin>> opcion; | |
switch(opcion) { | |
case 1: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
incertidumbre = sqrt(((pow(deltax,2))+(pow(deltay,2)))); | |
cout<<"La incertidumbre es: " << incertidumbre; | |
break; | |
case 2: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
cout<< "Ingresa X: "; | |
cin>>x; | |
cout<< "Ingresa Y: "; | |
cin>>y; | |
incertidumbre = sqrt(((pow(deltax,2))+(pow(deltay,2)))/(x+y)); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
break; | |
case 0: | |
repite= false; | |
break; | |
} | |
}while(repite); | |
} | |
void menu_res() | |
{ | |
bool repite= true; | |
int opcion; | |
do{ | |
system("cls"); | |
cout<<"\n\t Menu Resta\n"; | |
cout<< "\n\t1. Absoluta\n\n"; | |
cout<< "\n\t2. Relativa\n"; | |
cout<< "\n\t0. Salir\n"; | |
cout<< "\n\t Opcion: "; | |
cin>> opcion; | |
switch(opcion) { | |
case 1: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
incertidumbre = sqrt(((pow(deltax,2))+(pow(deltay,2)))); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
break; | |
case 2: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
cout<< "Ingresa X: "; | |
cin>>x; | |
cout<< "Ingresa Y: "; | |
cin>>y; | |
incertidumbre = sqrt(((pow(deltax,2))+(pow(deltay,2)))/(x-y)); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
system("pause>nul"); | |
break; | |
case 0: | |
repite= false; | |
break; | |
} | |
}while(repite); | |
} | |
void menu_mul() | |
{ | |
bool repite= true; | |
int opcion; | |
do{ | |
system("cls"); | |
cout<<"\n\t Menu Multiplicación\n"; | |
cout<< "\n\t1. Absoluta\n\n"; | |
cout<< "\n\t2. Relativa\n"; | |
cout<< "\n\t0. Salir\n"; | |
cout<< "\n\t Opcion: "; | |
cin>> opcion; | |
switch(opcion) { | |
case 1: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
cout<< "Ingresa X: "; | |
cin>>x; | |
cout<< "Ingresa Y: "; | |
cin>>y; | |
incertidumbre = (x*y)*(sqrt((pow(deltax,2))/(pow(x,2)))+((pow(deltax,2))/(pow(x,2)))); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
system("pause>nul"); | |
break; | |
case 2: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
cout<< "Ingresa X: "; | |
cin>>x; | |
cout<< "Ingresa Y: "; | |
cin>>y; | |
incertidumbre = sqrt(((pow(deltax,2))/(pow(x,2)))+((pow(deltax,2))/(pow(x,2)))); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
system("pause>nul"); | |
break; | |
case 0: | |
repite= false; | |
break; | |
} | |
}while(repite); | |
} | |
void menu_div() | |
{ | |
bool repite= true; | |
int opcion; | |
do{ | |
system("cls"); | |
cout<<"\n\t Menu Division\n"; | |
cout<< "\n\t1. Absoluta\n\n"; | |
cout<< "\n\t2. Relativa\n"; | |
cout<< "\n\t0. Salir\n"; | |
cout<< "\n\t Opcion: "; | |
cin>> opcion; | |
switch(opcion) { | |
case 1: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
cout<< "Ingresa X: "; | |
cin>>x; | |
cout<< "Ingresa Y: "; | |
cin>>y; | |
incertidumbre = (x/y)*(sqrt((pow(deltax,2))/(pow(x,2)))+((pow(deltax,2))/(pow(x,2)))); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
system("pause>nul"); | |
break; | |
case 2: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
cout<< "Ingresa X: "; | |
cin>>x; | |
cout<< "Ingresa Y: "; | |
cin>>y; | |
incertidumbre = sqrt(((pow(deltax,2))/(pow(x,2)))+((pow(deltax,2))/(pow(x,2)))); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
system("pause>nul"); | |
break; | |
case 0: | |
repite= false; | |
break; | |
} | |
}while(repite); | |
} | |
void menu_pow() | |
{ | |
bool repite= true; | |
int opcion; | |
do{ | |
system("cls"); | |
cout<<"\n\t Menu potencia\n"; | |
cout<< "\n\t1. Absoluta\n\n"; | |
cout<< "\n\t2. Relativa\n"; | |
cout<< "\n\t0. Salir\n"; | |
cout<< "\n\t Opcion: "; | |
cin>> opcion; | |
switch(opcion) { | |
case 1: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
cout<< "Ingresa X: "; | |
cin>>x; | |
cout<< "Ingresa la potencia: "; | |
cin>>potencia; | |
incertidumbre = pow(x,potencia)*potencia*(deltax/x); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
system("pause>nul"); | |
break; | |
case 2: | |
cout<< "Ingresa Delta X: "; | |
cin>>deltax; | |
cout<< "Ingresa Delta Y: "; | |
cin>>deltay; | |
cout<< "Ingresa X: "; | |
cin>>x; | |
cout<< "Ingresa la potencia: "; | |
cin>>potencia; | |
incertidumbre = potencia*(deltax/x); | |
cout<<"La incertidumbre es: "<< incertidumbre; | |
system("pause>nul"); | |
break; | |
case 0: | |
repite= false; | |
break; | |
} | |
}while(repite); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment