Help Using Set Parameters!

Im having a little trouble figuring out how to return more than one value through a function. Specifically one that stores 3 randomly generate numbers that can be stored and called later. Can anyone help me with this?
how to return more than one value through a function
Group your variables in a single structure/tuple:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
struct values
{
    int first;
    int second;
    int third;
};

values random_values()
{
    values v;
    v.first = 4;
    v.second = 7;
    v.third = 11;
    return v;
}


1
2
3
4
5
6
#include <tuple>

std::tuple<int, int, int> random_values()
{
    return {4, 7, 11};
}
Topic archived. No new replies allowed.