-
February 10th, 2012, 02:32 AM
#1
Convert from fahrenheit to celsius
Hi
Good Morning ,
Got Syntax error in the line (10)
error C2059: syntax error : ')'
I Use visual studio 2008
Here is my code ::
PHP Code:
# include <iostream>
using namespace std;
int main () {
double ctemp,ftemp;
cout << " Enter the f tempeature ";
cin >> ftemp;
ctemp=(ftemp - 32 /1.8.);
cout << " the c tempeature is : "<< ctemp;
system ("PAUSE");
return 0;
}
-
February 10th, 2012, 03:50 AM
#2
Re: Convert from fahrenheit to celsius
there is a . behind the 1.8
-
February 10th, 2012, 04:26 AM
#3
Re: Convert from fahrenheit to celsius
Dear Skizmo , i checked and i remove the . but i still get the wrong output
For example : input 75 F ,, get wrong output 57.2222
-
February 10th, 2012, 04:38 AM
#4
Re: Convert from fahrenheit to celsius
Code:
ctemp=(ftemp - 32 /1.8.);
Which happens first ? (ftemp - 32) or (32 / 1.8) ?
-
February 10th, 2012, 05:14 AM
#5
Re: Convert from fahrenheit to celsius
it must ( 32 / 1.8 ) happen first
is this acceptable statement ?
ctemp= ( 32 / 1.8 ) ( ftemp-32 );
-
February 10th, 2012, 05:55 AM
#6
Re: Convert from fahrenheit to celsius
finally it worked when i changed to only one variable declared ,, thanks
-
February 10th, 2012, 12:33 PM
#7
Re: Convert from fahrenheit to celsius
it must ( 32 / 1.8 ) happen first
is this acceptable statement ?
ctemp= ( 32 / 1.8 ) ( ftemp-32 );
In fact it should be just like this:
Code:
ctemp = (ftemp - 32) * 5 / 9;
http://www.mathsisfun.com/temperature-conversion.html
Last edited by Igor Vartanov; February 10th, 2012 at 12:35 PM.
Best regards,
Igor
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|