combination of data

I have a file with 4 columns of data. each column has 10 rows of data. I want to do all possible combinations of these 4 columns.

col1 col2 col3 col4
2 2.5 27 7.5
3 1.5 25 8.4

.
.
.

please help.
What do you mean by...

I want to do all possible combinations of these 4 columns.


that?
Is this what you mean?:
If this would be your array:

col1 col2 col3 col4:
A B C D
E F G H

then this would be the output:
A B C D
A B C H
A B G D
A B G H
A F C D
A F G D
...
E F G H
There is a next_permutation algorithm which can be used on a vector.

Have a read in the reference section top left of this page.

HTH
simpleasy

you are write. I want do the same combinations. 4 types of data with 10 different in each type can generate 10^4 = 10000 combinations. I could not understood how to use the next_permutation and how to read each column to develop the combinations.
use 4 for loops.
Topic archived. No new replies allowed.