I personally like to think of functions like little factories for information, parameters go in, the function does work, and the final product (return values) comes out. I assume that your second sentence should have said that the purpose of the program is to convert feet and inches into meters and centimeters? Here are the problems that I have found:
1) these two lines:
1 2
|
int r=calc_Meters;
float x=calc_Cent;
|
are function calls and thus need to have their parameters in there just like the two lines above it
1 2
|
int r = calc_Meters(totalFeet);
float x = calc_Cent(totalFeet,outputMeters);
|
i assume that those two errors were what was really making you frustrated.
2) the function "input" needs to have a return value of the type "float". that is the whole point of defining the function as
float input(int). if you have a function that doesnt have the return type of "void" then you need to have the function return a value.
3) this isnt really a major thing but i would recomend getting rid of your variable called "feet".
you only use it once (that i noticed).
instead of :
1 2
|
feet=inputFeet + inches/12;
totalFeet=feet;
|
change to:
totalFeet = inputFeet + inches / 12
4) why is the parameter in "input" called outputMeter? where you trying to make the "outputMeter" parameter list your output? you cannot output information from a fuction through the parameter list (except pass by reference, but i'll leave that for another day becuase that would take a lot of time and i dont like getting scooped when i answer questions on the internet (EDIT: Damit)). the correct way would be something like this:
return outputMeter;
I think you did the same thing in calc_Cent.
I would change the program to do something like this:
From main() call a function (maybe name it "input") that gets user input of feet and inches. next it converts the variable that stores feet into inches and adds this value to the variable that stores inches. then it converts the inches to cm (1in = 2.54cm) and returns the number of cm that the user inputed to the main function.
the main function stores the value returned from the input function in a variable (named "cm" maybe).
the cm variable is passed into a function (maybe named toMeters) that calculates, and returns to main, the number of meters in the cm variable.
lastly (now back in main), cm is passed into another function (maybe named toCent) that calculates, and returns to main, the remaining centimeters (maybe use the % operator?)
Also your calculations are a little off becuase it converts an input of 5ft 0in to 1m -347.6cm.
those were my thoughts so far.
PS where is your main() function?