This is a discussion on sorry to bother all but please help me :) within the C++ Programming forums, part of the General Programming Boards category; i have been trying to make a farenheit to celcius converter for about to days ( ya sorry its a ...

1. ## help w/ farenheit to celcius converter prog please :)

i have been trying to make a farenheit to celcius converter for about to days ( ya sorry its a big task for me i have only been coding for a day)
and i can get the loop and evrything to work but for some reason i cannot get the far temp to conv. to celcius . Say i was to enter 100 degrees far. i would get a 68 degrees cel. its like it is not reading the 5/9 before the far-32 any help would be appr. and here is my code

[code]

// Farenhiet to Celcius converter
#include <iostream>
using namespace std;

int main()
{
int a;
int b = 1;
do {
float far;
cout<<"Please enter youre farenheit amount to be converted to Celcius: ";
cin>>far;
cin.ignore();
float cel;
cel = (5/9)*(far-32);
cout<< far <<" degrees farneheit is: " << cel << " In Celcius\n";

cout<<"do you want to repeat?( 1 is no any other number is yes) ";
cin>>a;
cin.ignore();
}while ( a != b );
cin.get();
}

2. Nice attempt at code tags - shame you didn't review the post as well, then you'd see it was still a mess.

> 5 / 9
Is always 0 in C++
If you want a floating point division, then try 5.0 / 9.0

3. ok sorry

but ne ways i still try it and i get a 8.12753e-044 on everything i try to enter
Is there something wrong with the formula i am using or what ? I do not understand why it is doing this and anyhelp will be appreciated

oops sorry i made a simple coding mistake ty for the help it works now
sorry to bother

4. Code:
```#include <iostream>
using namespace std;

int main()
{
int a;
int b = 1;
do {
float far = 0.0F;
cout<<"Please enter youre farenheit amount to be converted to Celcius: ";
cin>>far;
cin.ignore();
float cel = 0.0F;
cel = (5.0 / 9.0)*(far-32);
cout<< far <<" degrees farneheit is: " << cel << " In Celcius\n";

cout<<"do you want to repeat?( 1 is no any other number is yes) ";
cin>>a;
cin.ignore();
}while ( a != b );
cin.get();
}```
That should work

5. Originally Posted by Salem
Nice attempt at code tags - shame you didn't review the post as well, then you'd see it was still a mess.

> 5 / 9
Is always 0 in C++
*tries resisting* I can'... it's too much...

Bwhahah.

Heh... well technically, that's in C so...

Quzah.

6. Originally Posted by quzah
*tries resisting* I can'... it's too much...