cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
combination of data
combination of data
Jan 28, 2013 at 10:53am
Jan 28, 2013 at 10:53am UTC
tatai
(76)
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.
Jan 28, 2013 at 11:01am
Jan 28, 2013 at 11:01am UTC
jaded7
(104)
What do you mean by...
I want to do all possible combinations of these 4 columns.
that?
Jan 28, 2013 at 12:07pm
Jan 28, 2013 at 12:07pm UTC
simpleasy
(28)
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
Jan 28, 2013 at 12:12pm
Jan 28, 2013 at 12:12pm UTC
TheIdeasMan
(6845)
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
Jan 30, 2013 at 2:06pm
Jan 30, 2013 at 2:06pm UTC
tatai
(76)
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.
Jan 30, 2013 at 2:23pm
Jan 30, 2013 at 2:23pm UTC
tntxtnt
(211)
use 4 for loops.
Topic archived. No new replies allowed.