What am I missing to get this farenheit to celsius program running? I am almost there but I keep getting this errors.
37 5 \farenheit1.cpp [Error] stray '\226' in program
\farenheit1.cpp In function 'int main()':
37 29 \farenheit1.cpp [Error] expected ')' before numeric constant
28 \Makefile.win recipe for target 'farenheit1.o' failed
Also, how would I do these two things?
1. Add in an if statement to check the input from the user. If input is correct continue on with the program, if not correct ask user for a new value
2. Add repetition after the solution is displayed to see if the user wants to continue with the program or quit.
Thank you in advance for any help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
//Variables
float Celsius; //represents the temperature in Celsius degrees
float Fahrenheit; //represents the converted temperature in Fahrenheit degrees
//Ask for the temperature in Fahrenheit temp
cout << "Enter Fahrenheit temperature: ";
cin >> Fahrenheit;
//Formula to convert degrees in Fahrenheit to Celsius degrees
//Important note: floating point literals need to have the '.0' in order to display the output properly
Celsius = (Fahrenheit – 32.0) * 5.0/9.0;
//Print the converted temperature to the console
cout << "Celsius = " << Celsius << endl;
}
|