Conversor de Temperaturas
Publicado por White Hawk (última atualização em 07/07/2011)
[ Hits: 24.861 ]
Download conversor_temperatura.c
Este é um script em C que realiza a conversão de temperaturas entre as escalas Celsius, Fahrenheits e Kelvin.
#include <stdio.h> int opcao; float tc, tf, tk; void Celsius_Fahrenheits() { printf("\nDigite a temperatura em Celsius.: "); scanf("%f", &tc); tf = ((9*tc + 160)/5); printf("\nA temperatura em Fahrenheits = %f\n", tf); } void Celsius_Kelvin() { printf("\nDigite a temperatura em Celsius.: "); scanf("%f", &tc); tk = (tc + 273); printf("\nA temperatura em Kelvin = %f\n", tk); } void Fahrenheits_Celsius() { printf("\nDigite a temperatura em Fahrenheits.: "); scanf("%f", &tf); tc = ((5*(tf - 32))/9); printf("\nA temperatura em Celsius = %f\n", tc); } void Fahrenheits_Kelvin() { printf("\nDigite a temperatura em Fahrenheits.: "); scanf("%f", &tf); tk = ((5*tf + 2297)/9); printf("\nA temperatura em Kelvin = %f\n", tk); } void Kelvin_Celsius() { printf("\nDigite a temperatura em Kelvin.: "); scanf("%f", &tk); tc = (tk - 273); printf("\nA temperatura em Celsius = %f\n", tc); } void Kelvin_Fahrenheits() { printf("\nDigite a temperatura em Kelvin.: "); scanf("%f", &tk); tf = ((9*tk - 2297)/5); printf("\nA temperatura em Fahrenheits = %f\n", tf); } main() { printf("==========CELSIUS <-> FAHRENHEITS==========\n"); printf("\n1-Celsius -> Fahrenheits\n2-Celsius -> Kelvin\n3-Fahrenheits -> Celsius\n4-Fahrenheits -> Kelvin\n5-Kelvin -> Celsius\n6-Kelvin -> Fahrenheits\n7-Sair\n\nOpcao.: "); scanf("%d", &opcao); switch (opcao) { case 1: Celsius_Fahrenheits(); break; case 2: Celsius_Kelvin(); break; case 3: Fahrenheits_Celsius(); break; case 4: Fahrenheits_Kelvin(); break; case 5: Kelvin_Celsius(); break; case 6: Kelvin_Fahrenheits(); break; case 7: printf("\nFinalizando o programa...\n"); break; default: printf("\nErro! Opcao inexistente.\n"); break; } return(0); }
Trabalhando com argumentos e ponteiros
Mostrando as palavras digitadas ao contrário!
Atenção a quem posta conteúdo de dicas, scripts e tal (6)
Como Configurar um Túnel SSH Reverso para Acessar Sua Máquina Local a Partir de uma Máquina Remota
Configuração para desligamento automatizado de Computadores em um Ambiente Comercial
O mínimo que você precisa saber sobre o terminal (parte 2)
O mínimo que você precisa saber sobre o terminal (parte 1)
Como iniciar uma máquina virtual do VirtualBox automaticamente no boot do LUbuntu 18 LTS
Mudar o gerenciador de login (GDM para SDDM e vice-versa) - parte 2
Como deixar as abas do Firefox mais fininhas
Mudar o gerenciador de login (GDM para SDDM)
"Tentando" fazer com que programas rodem no Wayland e no X11
Porblema com MergeList [RESOLVIDO] (10)
Melhor hospedagem em nuvem para projetos Laravel com baixo custo? [RES... (7)
Como baixar os drivers de áudio no linux mint? (7)
Como posso localizar o arquivo HTML da página inicial do GLPI dentro d... (2)
[Python] Automação de scan de vulnerabilidades
[Python] Script para analise de superficie de ataque
[Shell Script] Novo script para redimensionar, rotacionar, converter e espelhar arquivos de imagem
[Shell Script] Iniciador de DOOM (DSDA-DOOM, Doom Retro ou Woof!)
[Shell Script] Script para adicionar bordas às imagens de uma pasta