Calling a function

Hello,

I am having an issue with a homework program.

I've got the program for the most part except one part because it's basically wanting me to return 3 values from a single function and I'm unsure how to do this the way it wants me to. The rules:

Call the user-defined function to read in x in the series to be used for calculating the results. Pass a prompt for x as an input parameter, and return the validated x value to main.

After a valid x has been entered, call the same user defined function a second time, to read in y. Pass the prompt for y as an input parameter, and return the validated number of terms value to main.

After a valid y has been entered, call the same user-defined function a third time, to read in z. Pass the prompt for z as an input parameter, and return the validated z value to main.


Any hints/tips/ideas?

Thanks!
Last edited on
it's basically wanting me to return 3 values from a single function and I'm unsure how to do this the way it wants me to

Actually, it's asking you to write one function and call it three times.

For instance, if you have the following function written:

int GetValue(const char* prompt);

you could call it like this:

1
2
3
int x = GetValue("Please input x");
int y = GetValue("Please input y");
int z = GetValue("Please input z");
I figured it out.

Thank you very much!
Topic archived. No new replies allowed.