Actually none of your control paths returns a value. As you only use the function to print something on the screen, it does not have to return anything. Just make the return type void:
void bounce(int n) {
/*...*/
}
And then dont cout
the result of the function call (once you make it void
the function wont return anything anyhow), i.e. instead of:
std::cout << bounce(x) << std::endl;
simply write
bounce(x);
You already print on the screen inside the function.
0
solved C++ // Not all control paths return a value