Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <conio.h>
- using namespace std;
- int menu(), notacion(), conversionUnidades(), componentesVector();
- int printLogo(){
- cout << " _ _ \n/ " << char(92) <<" o _ | |_||_ " << char(92) << "/ _ o _ _\n" << char(92) <<"_X|_| | (_ |< | | | / _> | (_ _>\n";
- cout << "Quick Physics v0.4.1 - Best Titan (2024)\n\n";
- }
- // MENU PRINCIPAL
- int menu(){
- printLogo();
- int mode = 0;
- cout << "Escribe 1 para Notacion Cientifica\nEscribe 2 para Conversiones de Unidades\nEscribe 3 para Componentes de un Vector\n";
- cin >> mode;
- switch (mode){
- case 1:
- system("cls");
- notacion();
- break;
- case 2:
- system("cls");
- conversionUnidades();
- break;
- case 3:
- system("cls");
- componentesVector();
- break;
- default:
- cout << " // Valor invalido, ingrese porfavor un valor valido //";
- cout << endl << " // Presiona enter para volver al menu //";
- getch();
- system("cls");
- menu();
- }
- }
- // NOTACION CIENTIFICA
- int notacion(){
- printLogo();
- int mode = 0; double n = 0; int aux = 0;
- cout << "Escribe 1 para convertir a notacion cientifica \nEscribe 2 para convertir a notacion desarrollada \n";
- cin >> mode;
- if (mode == 1){
- cout << "Escribe el numero que quieres convertir a notacion cientifica ";
- cin >> n;
- if (n < 1){
- while (n < 1){
- n *= 10;
- aux--;
- }
- } else {
- while (n > 9.9999){
- n /= 10;
- aux++;
- }
- }
- cout << "\nTu numero en notacion cientifica es: " << n << " x10^" << aux << endl;
- cout << endl << endl << " // Presiona enter para volver al menu //";
- getch();
- system("cls");
- menu();
- } else if (mode == 2){
- cout << "Escribe el numero que quieres convertir a notacion desarrollada (solo el numero, sin el exponente) ";
- cin >> n;
- cout << "Escribe el exponente de 10 del numero a convertir a notacion desarrollada ";
- cin >> aux;
- if (aux > 0){
- while (aux > 0){
- n *= 10;
- aux --;
- }
- cout << "\nTu numero en notacion desarrollada es: "<< std::setprecision(0) << std::fixed << n; // para evitar que c++ automaticamente imprima con notacion cientifica
- cout << endl << endl << " // Presiona enter para volver al menu //";
- getch();
- system("cls");
- menu();
- } else {
- int aux1 = aux;
- while (aux < 0) {
- n /= 10;
- aux ++;
- }
- cout << "\nTu numero en notacion desarrollada es: "<< std::setprecision(abs(aux1)+2) << std::fixed << n;
- cout << endl << endl << " // Presiona enter para volver al menu //";
- getch();
- system("cls");
- menu();
- }
- }
- }
- // CONVERSIONES DE UNIDADES (LONGITUD, MASA, VOLUMEN)
- int conversionLongitud(), conversionMasa(), conversionVolumen();
- int conversionUnidades(){
- printLogo();
- string m1, m2; int n, mode = 0;
- cout << "Escribe 1 para convertir unidades de longitud\nEscribe 2 para convertir unidades de masa\nEscribe 3 para convertir unidades de volumen\n";
- cin >> mode;
- switch (mode) {
- case 1:
- system("cls");
- conversionLongitud();
- break;
- case 2:
- system("cls");
- conversionMasa();
- break;
- case 3:
- system("cls");
- conversionVolumen();
- break;
- default:
- cout << " // Valor invalido, ingrese porfavor un valor valido //";
- cout << endl << " // Presiona enter para volver a Conversion de Unidades //";
- getch();
- system("cls");
- conversionUnidades();
- }
- }
- int conversionLongitud(){
- printLogo();
- string convInput, convOutput; double n = 0, ans;
- cout << "Escribe la unidad de medida que quieres convertir (m, hm, cm, mm, km, yd, mi, ft, in) ";
- cin >> convInput;
- cout << "Escribe la unidad de medida a la que se va a convertir (m, hm, cm, mm, km, yd, mi, ft, in) ";
- cin >> convOutput;
- cout << "Escribe la cantidad a convertir (En numeros) ";
- cin >> n;
- ans = n;
- if (convInput == "m"){
- if(convOutput == "cm") ans *= 100;
- if(convOutput == "hm") ans /= 100;
- if(convOutput == "mm") ans *= 1000;
- if(convOutput == "km") ans /= 1000;
- if(convOutput == "yd") ans *= 1.093;
- if(convOutput == "ft") ans *= 3.279;
- if(convOutput == "in") ans /= 0.0254;
- if(convOutput == "mi") ans /= 1609;
- }
- if (convInput == "hm"){
- if(convOutput == "m") ans *= 100;
- if(convOutput == "cm") ans *= 10000;
- if(convOutput == "mm") ans *= 100000;
- if(convOutput == "km") ans /= 10;
- if(convOutput == "yd") ans *= 109.3;
- if(convOutput == "ft") ans *= 327.9;
- if(convOutput == "in") ans *= 3937;
- if(convOutput == "mi") ans /= 16.09;
- }
- if (convInput == "cm"){
- if(convOutput == "m") ans /= 100;
- if(convOutput == "hm") ans /= 10000;
- if(convOutput == "mm") ans *= 10;
- if(convOutput == "km") ans /= 100000;
- if(convOutput == "yd") ans /= 91.44;
- if(convOutput == "ft") ans /= 30.48;
- if(convOutput == "in") ans /= 2.54;
- if(convOutput == "mi") ans /= 160934;
- }
- if (convInput == "mm"){
- if(convOutput == "m") ans /= 1000;
- if(convOutput == "hm") ans /= 100000;
- if(convOutput == "cm") ans /= 10;
- if(convOutput == "km") ans /= 1000000;
- if(convOutput == "yd") ans /= 914.4;
- if(convOutput == "ft") ans /= 304.8;
- if(convOutput == "in") ans /= 25.4;
- if(convOutput == "mi") ans /= 1609344;
- }
- if (convInput == "km"){
- if(convOutput == "m") ans *= 1000;
- if(convOutput == "hm") ans *= 10;
- if(convOutput == "cm") ans *= 100000;
- if(convOutput == "mm") ans *= 1000000;
- if(convOutput == "yd") ans *= 1093.61;
- if(convOutput == "ft") ans *= 3280.84;
- if(convOutput == "in") ans *= 39370;
- if(convOutput == "mi") ans /= 1.60934;
- }
- if (convInput == "yd"){
- if(convOutput == "m") ans *= 0.9144;
- if(convOutput == "hm") ans /= 109.361;
- if(convOutput == "cm") ans *= 91.44;
- if(convOutput == "mm") ans *= 914.4;
- if(convOutput == "km") ans /= 1093.61;
- if(convOutput == "ft") ans *= 3;
- if(convOutput == "in") ans *= 36;
- if(convOutput == "mi") ans /= 1.760;
- }
- if (convInput == "ft"){
- if(convOutput == "m") ans *= 0.3048;
- if(convOutput == "hm") ans /= 328.084;
- if(convOutput == "cm") ans *= 30.48;
- if(convOutput == "mm") ans *= 304.8;
- if(convOutput == "km") ans /= 3280.84;
- if(convOutput == "yd") ans /= 3;
- if(convOutput == "in") ans *= 12;
- if(convOutput == "mi") ans /= 5280;
- }
- if (convInput == "in"){
- if(convOutput == "m") ans *= 0.0254;
- if(convOutput == "hm") ans /= 3937.01;
- if(convOutput == "cm") ans *= 2.54;
- if(convOutput == "mm") ans *= 25.4;
- if(convOutput == "km") ans /= 39370.1;
- if(convOutput == "yd") ans /= 36;
- if(convOutput == "in") ans /= 12;
- if(convOutput == "mi") ans /= 63360;
- }
- if (convInput == "mi"){
- if(convOutput == "m") ans *= 1609.34;
- if(convOutput == "hm") ans *= 16.0934;
- if(convOutput == "cm") ans *= 160934;
- if(convOutput == "mm") ans *= 1609344;
- if(convOutput == "km") ans *= 1.60934;
- if(convOutput == "yd") ans *= 1760;
- if(convOutput == "in") ans *= 5280;
- if(convOutput == "in") ans *= 63360;
- }
- cout << endl << n << convInput << " equivale a " << ans << convOutput;
- cout << endl << endl << " // Presiona enter para volver al menu //";
- getch();
- system("cls");
- menu();
- }
- int conversionMasa(){
- printLogo();
- string convInput, convOutput; double n = 0, ans;
- cout << "Escribe la unidad de masa que quieres convertir (kg, g, lb, ton, on) ";
- cin >> convInput;
- cout << "Escribe la unidad de masa a la que se va a convertir (kg, g, lb, ton, on) ";
- cin >> convOutput;
- cout << "Escribe la cantidad a convertir (En numeros) ";
- cin >> n;
- ans = n;
- if (convInput == "kg"){
- if(convOutput == "g") ans *= 1000;
- if(convOutput == "lb") ans *= 2.20462;
- if(convOutput == "ton") ans /= 1000;
- if(convOutput == "on") ans *= 35.274;
- }
- if (convInput == "g"){
- if(convOutput == "kg") ans /= 1000;
- if(convOutput == "lb") ans /= 453.592;
- if(convOutput == "ton") ans /= 1000000;
- if(convOutput == "on") ans /= 28.3495;
- }
- if (convInput == "lb"){
- if(convOutput == "kg") ans /= 2.20462;
- if(convOutput == "g") ans *= 453.592;
- if(convOutput == "ton") ans /= 2204.62;
- if(convOutput == "on") ans *= 16;
- }
- if (convInput == "ton"){
- if(convOutput == "kg") ans *= 1000;
- if(convOutput == "g") ans *= 1000000;
- if(convOutput == "lb") ans *= 2204.62;
- if(convOutput == "on") ans *= 35274;
- }
- if (convInput == "on"){
- if(convOutput == "kg") ans /= 35.274;
- if(convOutput == "g") ans *= 28.3495;
- if(convOutput == "lb") ans /= 16;
- if(convOutput == "ton") ans /= 35274;
- }
- cout << endl << n << convInput << " equivale a " << ans << convOutput;
- cout << endl << endl << " // Presiona enter para volver al menu //";
- getch();
- system("cls");
- menu();
- }
- int conversionVolumen(){
- printLogo();
- string convInput, convOutput; double n = 0, ans;
- cout << "Escribe la unidad de volumen que quieres convertir (l, ml, cm3, dm3, m3, gal) ";
- cin >> convInput;
- cout << "Escribe la unidad de volumen a la que se va a convertir (l, ml, cm3, dm3, m3, gal) ";
- cin >> convOutput;
- cout << "Escribe la cantidad a convertir (En numeros) ";
- cin >> n;
- ans = n;
- if (convInput == "cm3"){
- if(convOutput == "ml") ans *= 1;
- if(convOutput == "l") ans /= 1000;
- if(convOutput == "dm3") ans /= 1000;
- if(convOutput == "m3") ans /= 1000000;
- if(convOutput == "gal") ans /= 3785.41;
- }
- if (convInput == "ml"){
- if(convOutput == "cm3") ans *= 1;
- if(convOutput == "l") ans /= 1000;
- if(convOutput == "dm3") ans /= 1000;
- if(convOutput == "m3") ans /= 1000000;
- if(convOutput == "gal") ans /= 3785.41;
- }
- if (convInput == "l"){
- if(convOutput == "ml") ans *= 1000;
- if(convOutput == "cm3") ans *= 1000;
- if(convOutput == "dm3") ans *= 1;
- if(convOutput == "m3") ans /= 1000;
- if(convOutput == "gal") ans /= 3.78541;
- }
- if (convInput == "dm3"){
- if(convOutput == "ml") ans *= 1000;
- if(convOutput == "cm3") ans *= 1000;
- if(convOutput == "l") ans *= 1;
- if(convOutput == "m3") ans /= 1000;
- if(convOutput == "gal") ans /= 3.78541;
- }
- if (convInput == "m3"){
- if(convOutput == "ml") ans *= 1000000;
- if(convOutput == "cm3") ans *= 1000000;
- if(convOutput == "dm3") ans *= 1000;
- if(convOutput == "l") ans *= 1000;
- if(convOutput == "gal") ans *= 264.172;
- }
- if (convInput == "gal"){
- if(convOutput == "ml") ans *= 3785.41;
- if(convOutput == "cm3") ans *= 3785.41;
- if(convOutput == "dm3") ans *= 3.78541;
- if(convOutput == "l") ans *= 3.78541;
- if(convOutput == "m3") ans /= 264.172;
- }
- cout << endl << n << convInput << " equivale a " << ans << convOutput;
- cout << endl << endl << " // Presiona enter para volver al menu //";
- getch();
- system("cls");
- menu();
- }
- // COMPONENTES DE UN VECTOR
- int componentesVector(){
- printLogo();
- int F, n, cuadrante;
- char sentido;
- cout << "Escribe la cantidad de la fuerza del vector "; cin >> F;
- cout << "Escribe el angulo de la fuerza del vector "; cin >> n;
- cout << "Escribe el cuadrante en el que se encuentra el angulo en el vector "; cin >> cuadrante;
- cout << "Escribe 'a' si el sentido del angulo es antihorario, y 'h' si es horario "; cin >> sentido;
- int anguloReal = ((sentido == 65) || (sentido == 97) ? n : 90-n)+90*(cuadrante-1);
- cout << "El angulo real es: " << anguloReal << endl;
- cout << "Fx = " << std::setprecision(4) << std::fixed << F*cos(anguloReal* 3.14159265 / 180) << endl; // grados a radiales?
- cout << "Fy = " << std::setprecision(4) << std::fixed << F*sin(anguloReal* 3.14159265 / 180); // grados a radiales?
- cout << endl << endl << " // Presiona enter para volver al menu //";
- getch();
- system("cls");
- menu();
- }
- int main(){
- menu();
- }
Advertisement
Add Comment
Please, Sign In to add comment