please i need to know if this code will work well for conversion of Celsius to Fahrenheit>...................please i need immediate help
please note this code is not all that complete
Why don't you test it to see if it works? Once you test it, you will see that in line 15, you are attempting to pass variables that don't exist in the main() function (namely the variables called a, c, and d).
I think your function far() should be simplified to accept a single parameter. Something like this:
1 2 3 4 5
double far(double c)
{
double f = etc; // do the calculation here;
return f;
}
In the existing code, the lines are in the wrong order: a=9,c=5,d=32; these values are assigned too late, after they have already been used. But really, you don't need individual variables, just put the numbers direct into the calculation. Be careful to use 9.0 and 5.0 so that floating-point rather than integer division will be done.
Thanks a lot..... I had a feeling something was wrong...... So u are saying I don't need to call extra parameters..... And even if I do it should be like inside the int(main)?
The function does a specific task, it converts Celsius to Fahrenheit. That leads to a straightforward requirement, one input (the parameter) and one output (the returned value).
All the other numbers (32, 5, 9 etc.) belong inside the body of the function. How you do that is up to you, but there is definitely no need for them to be supplied as extra parameters.