[prog] functions

Wolfgang Petzold petzold at villa-chaos.de
Sat Dec 18 18:37:19 EST 2004


Hello!

Am 12/18/2004 08:02 AM schrieb Wolf Rising:
> Would anyone happen
> to see what I'm doing incorrectly or did I just get lucky that one
> function worked to begin with? :-)

> float cel(float temp)
> {
> 	return (5.0 / 9.0 *  temp - 32);
> }
> 
> //define function
> float fahr(float temp)
> {
> 	return (9.0 / 5.0 * temp + 32);
> }

Basic math. (Try writing down these formulas like you learnt in school;
I personally can see things better then.)

I don't know the correct formula by heart, but if

     5
c = --- f + 32,
     9

then

      9
f != --- c - 32.
      5

Regards
Wolfgang


More information about the Programming mailing list