On Sun, Jan 24, 2010 at 1:35 AM, Erika Elisa F. <[email protected]> wrote:
> I have a lot of trouble doping this homework, if you can help me it would be
> great:
>
> Design a program that converts Celsius temperatures to Fahrenheit
> temperatures. The formula is as follows:
> F= (9/5) C + 32
>
> The user will be ask to enter he degrees and he/she will see it the result at
> the end.
>
> This is what I did:
>
> /*Conversion Program*/
> #include <iostream>
> #include <string>
> using namespace std;
> int main()
> {
> double ftemp;
> double ctemp;
> cout<<"-Converting Fahrenheit to Celsius-"<<endl;
> cout<<"Enter temperature in Fahrenheit to convert to Celcius: ";
> cin>>ftemp;
> ctemp=(ftemp-32)*5/9;
That's doing the opposite conversion from F to C. (And it works if
that is what it's supposed to do.)
However, the assignment appears to require C to F, using the formula
you gave earlier.
> cout<<"The temperature in Celsius is: "<<ctemp<<endl;
> return (0);
--
PJH
http://shabbleland.myminicity.com/
http://www.chavgangs.com/register.php?referer=9375
http://www.kongregate.com/?referrer=Shabble