1
When I type the temperature in Fahrenheint the program returns 0 as a result, where is the error?
#include <cstdlib>
#include <iostream>
#include <conio.h>
#include <string.h>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
float celsius = 0, fah = 0;
char tecla;
cout << "Digite a temperatura em C°:"; cin >> celsius;
fah = (9 * celsius + 160) / 5;
cout << "Temperatura em F°:" << fah << endl;
cout << "Digite a temperatura em F°:"; cin >> fah;
celsius = (fah - 32) * (5/9);
cout << "Temperatura em C°:" << celsius << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Review the formula you are using for conversion from Fahrenheint to Celsius
– Caique Romero
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site
– Maniero