-
function call
Hello all!
I'm trying to write a program that reads in length in feet and inches, and outputs the equivalent meters and centimeters using at least 3 functions (input, calculate and output). The program includes a loop that allows the user to calculate as often as they'd like. The program runs, but doesn't calculate correctly. I know at a minimun my function call is wrong, but I don't know how to fix it. Any suggestions?
Thanx
-
For one, you should be passing your variables (feet, inches, etc.) by reference, not value.
-
i have to head out so heres a very quick reply, and maybe i can get back to it another time:
- please post your code using code tags, making us download and look at the file is another step for us (who are already offering help for free)
- your "input" function must take those 2 parameters by reference, look this up and learn it if you havent heard it before, or simply put the logic in this function into main (instead of creating a function for it, which doesnt really help)
- if you follow the logic of your code, the "equiv_m" function will accept 2 arguments, the first of which, "feet", is being used without being initialized (resulting in "undefined" behaviour)
- in this same function, the last line wont ever be executed because the second last line is a return statement (so the function "exits" after the return)
i havent read the rest but i imagine you can start from there.
-
-
I apologize for not sending the tags; I uploaded the wrong file. Thanks for all your help!