Jump to content
Sign in to follow this  
Read

Make a number combinations

Recommended Posts

Read

I have six numbers and how to make combinations?

Example:

Numbers:

01 02 03 04 05 06

Now must make a combinations:

01, 02, 03, 04, 05

01, 02, 03, 04, 06

01, 02, 03, 05, 06

01, 02, 04, 05, 06

01, 03, 04, 05, 06

02, 03, 04, 05, 06

We must use array:

16 23 34 36 37 44

13 17 26 30 32 38

and to make of combinations...

Very thanks

Share this post


Link to post
Share on other sites
jdelaney

look into _arraypermute and _arraycombinations, or please explain your issue a bit more...


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Read

My English is not good.

Array: 01 02 03 04 05 06

And make of combinations... 01 02 03 04 05 06

result:

01, 02, 03, 04, 05

01, 02, 03, 04, 06

01, 02, 03, 05, 06

01, 02, 04, 05, 06

01, 03, 04, 05, 06

02, 03, 04, 05, 06

Combinations save in .txt file.

Share this post


Link to post
Share on other sites
jdelaney

there is nothing to understand, run it ;)

#include <Array.au3>
Local $aArray[6] = ["01","02","03","04","05","06"]
Local $aNewArray = _ArrayPermute($aArray, ",") ;Using Default Parameters
_ArrayDisplay($aNewArray, "Array Permuted")
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Read

Cant understand...

Share this post


Link to post
Share on other sites
iamtheky

Cant understand...

Then this might not help either, but dumping this array to a txt file looks similar to your expected result

#include<array.au3>
Local $aArray[6] = ["01","02","03","04","05","06"]
Local $aNewArray = _ArrayCombinations($aArray, 5 , ",")
_ArrayDisplay($aNewArray, "Array Combos")
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Read

Now is correct but i add more line and not work anymore.

#include<array.au3>
Local $aArray[6] = ["01","02","03","04","05","06"]
Local $aArray[6] = ["7","9","18","19","35","40"]
Local $aNewArray = _ArrayCombinations($aArray, 5 , ",")
_ArrayDisplay($aNewArray, "Array Combos")

Share this post


Link to post
Share on other sites
iamtheky

#include<array.au3>
Local $aArray[6] = ["01","02","03","04","05","06"]
_ArrayDisplay($aArray, "Array Combos")
Local $aArray[6] = ["7","9","18","19","35","40"]
_ArrayDisplay($aArray, "Array Combos")

You are not doing what you intend. Read the helpfile.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Read

i'm not programmer...

Somebody...

Share this post


Link to post
Share on other sites
somdcomputerguy

Now is correct but i add more line and not work anymore.

#include<array.au3>
Local $aArray[6] = ["01","02","03","04","05","06"]
Local $aArray[6] = ["7","9","18","19","35","40"]
Local $aNewArray = _ArrayCombinations($aArray, 5 , ",")
_ArrayDisplay($aNewArray, "Array Combos")

You have two variables with the same name. Rename one of them.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Read

How How How???

You have two variables with the same name. Rename one of them.

Edited by Read

Share this post


Link to post
Share on other sites
iamtheky

you are really not going to explore the helpfile, or even try? you should change your name to "not going to read".. .


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Read

I'm not programmer and don't understand this language.

Share this post


Link to post
Share on other sites
kylomas

Read,

I'm not programmer and don't understand this language.

This would beg the question, "why are you doing this?".

To get help you need to provide examples of what you expect, what is happenning/not happening, and, whatever code you have written.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
Read

hmm ;)

#include<array.au3>
Local $aArray[6] = [("01","02","03","04","05","06")|("7","9","18","19","35","40")]
Local $aNewArray = _ArrayCombinations($aArray, 5 , ",")
_ArrayDisplay($aNewArray, "Array Combos")
Edited by Read

Share this post


Link to post
Share on other sites
somdcomputerguy

You have two variables with the same name. Rename one of them.

How How How???

#include<array.au3>
Local $aArray[6] = ["01","02","03","04","05","06"]
Local $aArray[6] = ["7","9","18","19","35","40"]
Local $aNewArray = _ArrayCombinations($aArray, 5 , ",")
_ArrayDisplay($aNewArray, "Array Combos")

#include<array.au3>
Local $aArray[6] = ["01","02","03","04","05","06"]
Local $bArray[6] = ["7","9","18","19","35","40"] ; this array is not named the same as the one before it!
Local $aNewArray = _ArrayCombinations($aArray, 5 , ",")
_ArrayDisplay($aNewArray, "Array Combos")

See the difference? Perhaps I confused you by calling an array a variable..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×