Saltar al contenido
Underc0de /foro

Conversor de temperaturas en C++

Iniciado por Jhonjhon_123, Febrero 23, 2010, 07:54:39 PM

Tema anterior - Siguiente tema

0 Miembros y 0 Visitantes están viendo este tema.

Avatar de Jhonjhon_123
Febrero 23, 2010, 07:54:39 PM Ultima modificación: Febrero 08, 2014, 05:44:22 PM por Expermicid

Bueno, aquí otra practica conversa centigrados, farenhait y kelvin.

Código: cpp
#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!
WhatsApp Telegram
Los enlaces son solo para miembros. Registrate o iniciá sesión

1 respuesta

Avatar de P4|3L0
Y quien usa el switch?

¿Te quedó una duda sobre Códigos Fuentes?

Preguntala y te responde la comunidad (y el asistente Underc0de IA si nadie llega antes). Es gratis y tarda un minuto.

Ya tengo cuenta
Guardamos tu pregunta en este navegador: después de entrar la publicás con un clic.
Grupo de WhatsApp