The tutorial available on this website http://www.cplusplus.com/doc/tutorial/
will remedy the issues you are encountering.
double getLength(double y);
To pass y by reference you should change the prototype / implementation to reflect this (note the addition of the & operator ):
double getLength(double & y);
But based on how you are using the code passing by reference nullifies the need for the return type "double" so it should logically be changed to this
void getLength(double & y);
My other suggestion was to use the double's you are returning.
In your getLength() function you return y at the end of it. If you look inside your main function there is no variable there to recieve the return value.
If you want to store that double value there needs to be something there to get assigned that value. You could change the code in main to reflect that by doing something like
double length; // declared somewhere in main
length = getLength();
In this case no parameter needs to be passed to getLength, so your function prototype should be
If this is above your head I urge you to read some more.