Underc0de

Programación General => C / C++ => Códigos Fuentes => Mensaje iniciado por: Jhonjhon_123 en Febrero 23, 2010, 07:54:39 PM

Título: Conversor de temperaturas en C++
Publicado por: Jhonjhon_123 en Febrero 23, 2010, 07:54:39 PM
Bueno, aquí otra practica conversa centigrados, farenhait y kelvin.

Código (cpp) [Seleccionar]
#include <iostream>
#include <cstdlib>
#include <stdio.h>

using namespace std;

int main()
{

/*CodeD by KilerSys
www.internetizados.wordpress.com*/

    double num;
    int opt;
    system("title Conversor de temperaturas");
    cout << "#Coded by KilerSys\n#Conversor de temperaturas v1.0\n#www.internetizados.wordpress.com\n\nConvertir:\n1. Centigrados/Celsius a Farenheit\n2. Farenheit a Centigrados/Celsius\n3. Farenheit a Kelvin\n4. Kelvin a Farenheit\n5. Kelvin a Centigrados/Celsius\n6. Centigrados/Celsius a Kelvin\n0. Salir\n\nOpcion: ";
    cin >> opt;
    if(opt==1){
               cout << "Escribe los Grados Centigrados/Celsius: ";
               cin >> num;
               cout << "\n " << num << " Grados Centigrados/Celsius son " << (num + 32) * 1.8 << " Grados Farenheit." << endl;
               system("pause");
               }
    if(opt==2){
               cout << "Escribe los Grados Farenheit: ";
               cin >> num;
               cout << "\n " << num << " Grados Farenheit son " << (num - 32) / 1.8 << " Grados Centigrados/Celsius." << endl;
               system("pause");
               }
    if(opt==3){
               cout << "Escribe los Grados Farenheit: ";
               cin >> num;
               cout << "\n " << num << " Grados Farenheit son " << (num + 459.67) / 1.8 << " Grados Kelvin." << endl;
               system("pause");
               }
    if(opt==4){
               cout << "Escribe los Grados Kelvin: ";
               cin >> num;
               cout << "\n " << num << " Grados Kelvin son " << (num * 1.8) - 459.67 << " Grados Farenheit." << endl;
               system("pause");
               }
    if(opt==5){
               cout << "Escribe los Grados Kelvin: ";
               cin >> num;
               cout << "\n " << num << " Grados Kelvin son " << (num - 273.16) << " Grados Centigrados." << endl;
               system("pause");
               }
    if(opt==6){
               cout << "Escribe los Grados Centigrados/Celsius: ";
               cin >> num;
               cout << "\n " << num << " Grados Centigrados/Celsius son " << num + 273.16 << " Grados Kelvin." << endl;
               system("pause");
               }
    if(opt==0){
               cout << "Hasta la proxima." << endl;
               system("pause");
               return EXIT_SUCCESS;
}
}


Saludos!
Título: Re:Conversor de temperaturas en C++
Publicado por: P4|3L0 en Agosto 10, 2012, 08:47:02 AM
Y quien usa el switch?