Math error

Why is the “/” showing up as an error.
why tho
The error is “src/main.cpp:35:17: warning: expression result unused [-Wunused-value]”

The reason why is because your doing math that isn’t being assigned to a variable, which wastes processing power. Its similar to creating a variable then never using it.


Isn’t inch a variable? Wouldn’t it be assigned to that?

Inches is a variable however you are just doing a math operation using inches without modifying a variable or returning a value. If you are looking to access the result of said expression you would either need to have another variable outside of the scope of the function and assign that expression to it or do something like this.

double inch (int inches){
return (inches * 360) / (3.25 * M_PI); // you can use this constant of the math class for pi

Then when you want to use your function you would do something like this.

int num = 3

double newNum = inch(num);