New to C++

Write a C++ application that is intended to covert temperatures in centigrade to the equivalent in Fahrenheit. First write the equation in the following way:

double c = 100.0; //temperature in centigrade
double f; //temperature in Fahrenheit
f = (9/5)*c+32.0; //conversion equation

We expect the result to be 212.0. Observe that the result is incorrect.

Determine why the result is incorrect and make the appropriate change to the code that will give the correct result.

Record the results in a output file that shows both the erroneous result and the correct result.

Can someone tell me why that is incorrect? I assumed it's because (9/5) should be (9.0/5.0) not sure though, this is part of a study guide for my test.

Write a C++ application that will declare the following variables (x, y and z) with initial values of 10.0 and will execute the following formulas. All variables are to be double-precision floating point numbers.

a = 3x + y

b =

c =

Also need help with this and explain how to do that.

Thanks guys help is appreciated.
1. yes, it should be 9.0/5 (it's enough if one of them is a double). Does that still not work?

2. double a = 3*x+y; ?
Topic archived. No new replies allowed.