New to C++ and have a problem with an assignment Please Help!

I am horrible at C++ (only in my second week of IT 218) and have to write a simple temperature conversion console program. I am trying to convert Celsius to both Fahrenheit and Kelvin but I keep popping up an INT error and I cannot seem to figure it out. Would it be ok to post it here and maybe have someone take a look at what I have and maybe point out my goof? Thanks in advance, I will wait to post until someone gives me the go ahead.
I can build the solution without any errors so I am puzzled. I'm just gonna post it and hope someone gives it a glance.


// Temperature conversion in cpp.

#include <iostream>
using namespace std;
int main ()
{
int temp; // values to determine temperature
int tf; // temperature in degree fahrenheit
int tk; // temperature in degree kelvin
int tc; // temperature in degree celsius
int value;

cout << "What do you want to convert? please select from below!" << endl;
// Prompt User
cout << " 1.Convert from celsius to fahrenheit. " << endl;
cout << " 2.Convert from celsius to kelvin. " << endl;
cin >> value; // user selects a value by either pressing 1 or 2.
// the input of a correct variable is determined.
if ( value==1 )
{
cout << " Please insert a number to change from celsius to fahrenheit "
<< endl;
cin >> temp; // prompts Value for user to enter
tf = (9/5)*tc+32;
cout << " Your value is,"<< tf << " fahrenheit "
<< endl; // result to be displayed
}
else if (value==2)
{
cout << " Please insert a number to change from celsius to kelvin "
<< endl;
cin >> temp; // prompts Value for user to enter
tk = tc+273.15;
cout <<" Your value is,"<< tk <<" kelvin "
<< endl; // result to be displayed
}
else {
cout << " Please enter either 1 or 2 only "; //shows when any other value than 1 or 2 is pressed.
}
return 0; // end of program
}
Try changing all your variables except value to double.

Find out what the difference between the types int & double is.
Find out what happens when you divide ints.

In future please always use code tags. Select  your code then press the <> button on the  right.
ok will try that, thank you! and sorry for not using the tags.
Topic archived. No new replies allowed.