# Thread: noob error returning a function evaluation

1. ## noob error returning a function evaluation

I can't seem to figure out why this isn't returning the quotient of inches*2.54, even though I think to convert from inches to centimeters it should be inches/2.54. Anyways I can't get that value, I either get a warning saying "the address of 'float inches_to_centimeters(float)', will always be 'true' " or else I get an error saying something about the stuff under the { after if. I only get the error when I change the return in the function to "return (inches*2.54);
Here's the code, if anyone can help...
Code:
```/*
* Name : xxxxxx xxxxxxx
* Course : cps
* Assignment : Homework03
* Description : Convert from english units to metric and vice versa.
*/

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

float inches_to_centimeters(float inches);
int main()
{
string conversion;
cout << "Please enter the name of the units you would like to convert to" << endl;
cout << "   -Ex. to convert from inches to centimeters, enter \"inches\"" << endl;
cout << "The following are the available conversions: " << endl;
cout << "    inches, centimeters, feet, meters, miles, kilometers" << endl;
cin >> conversion;
if (conversion == "inches")
{
float inches_to_centimeters(float inches);
cout << inches_to_centimeters << endl;
}
else
{
cout << "no" << endl;
}
}
/*
* Name: inches_to_centimeters
* Purpose: Convert inches to centimeters
* Receive: A number in inches
* Return: Equivalent number in centimeters
*/

float inches_to_centimeters(float inches)
{
cout << "The number of inches is: ";
cin >> inches;
(inches*2.54);
return 0;
}```

2. Code:
```    if (conversion == "inches")
{
float inches_to_centimeters(float inches);
cout << inches_to_centimeters << endl;
}```
When you make a call to a function you do not specify the return type or the type of the parameter.

You need to review how to call functions, how to get a return value, and how to pass parameter.

(inches*2.54);
This has has no affect as the result is not stored.

3. I originally had it as this
return (inches*2.54);
(inches*2.54);
return 0;

4. Wow, this just makes my head hurt:
Code:
```if (conversion == "inches")
{
float inches_to_centimeters(float inches);
cout << inches_to_centimeters << endl;
}```
Seriously, you need to review functions in general. If you have specific questions post them.

5. Yea, well I figured out that for this program I only needed to make it a test driver, so I didn't need the if statement or anything. I'm just beginning to learn C++ that's why i'm so bad at it. I thank you for your input though.

6. Here is how a simple function works:
Code:
```#include<iostream>
using namespace std;

double simple(int a)
{
double temp = a * 1.5;
return temp;
}

int main()
{
int some_int = 9;
double result = simple(some_int);
cout<<result<<endl;

return 0;
}```