Modify a void function to a value-returning

mac193 (6)
I'm not sure how to change a void function into a value-returning one. The function we were given for class is,
void convertToMeters (int ft, double in, double& m);
Moschops (5961)
To make it return an int:

int convertToMeters (int ft, double in, double& m);

and stick return someInt; in it.
BlackSheep (388)
1
2
3
4
5
double convertToMeters (int ft, double in, double& m)
{
//Conversion
return meters;
}

Although you're passing m (meters?) by reference which means that any changes inside the function will affect the variable outside the function.
Registered users can post here. Sign in or register to post.