Help? Returning multiple variables with a function

Hello and thank you for any help in advance.

I am currently working on a c++ assignment as follows:
Specific Tasks:
Write a program that repeatedly
1. Inputs an initial height and initial velocity for a ball being thrown

2. Echoes back (displays to the console) the initial height and velocity

3. Displays a table of times, height and velocity, with time increasing in 1/4 second intervals, until the ball hits the ground

4.Calculates and displays the maximum height of the ball

5.Calculates and displays the exact time the ball hits the ground

You must have functions that do the following:
•Does the input for the initial height and initial velocity (hint: since you’re getting two pieces of information, you’ll need to use reference parameters)

•Calculate current height of the ball, given an initial height, initial velocity, and a time

•Calculate the maximum height of the ball, given an initial height and initial velocity (question: when is the ball at its maximum height?)

•Calculate the current velocity of the ball, given an initial velocity and a time

•Calculate the time the ball hits the ground, given an initial height and initial velocity

•Calculates and displays the table discussed above.



I have the code pretty much completed; however, I am struggling a bit with figuring out how to return both the initial velocity and the initial height in the function which imputs them in order to use them in the rest of my functions.

How should I use reference parameters to do so? Do I need to use reference variables (double& initialHeight instead of passing by value with just initialHeight) in all of my other functions as well? How should I call the function in the int main()?

Thanks!
I got an answer to this problem in the general C++ forum. Thanks Grey Wolf!
Topic archived. No new replies allowed.