RE: [Dev-C++] Code for all combinations
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Rodolfo D. <rod...@la...> - 2003-07-23 04:31:18
|
Hi,=20
just curiosity, is that a school assignment? An idea would be to nest =
six for statements.
Regards
Rodolfo d'Ettorre
-----Original Message-----
From: Andr=E9 Mac=E1rio Barros [mailto:and...@su...]
Sent: Wednesday, 23 July 2003 1:54 PM
To: Dev-Cpp-Users
Subject: [Dev-C++] Code for all combinations
Dear Users,
I need to test all possibilities in a specific code.
I couldn=B4t realize how I can generate theese possibilities with two
for=B4s.
Here is the problem:
Suppose you have a vector like
int vect[6]=3D{0};
How could be a C code to have (print for example) all possible
combinations in the
six positions from the range 0 to 10?
the output is something like:
0 , 0, 0, 0, 0, 0
1 , 0, 0, 0, 0, 0
2 , 0, 0, 0, 0, 0
...
10, 0, 0, 0, 0, 0
0 , 1, 0, 0, 0, 0
0 , 2, 0, 0, 0, 0
...
0 ,10, 0, 0, 0, 0
1, 1, 0, 0, 0, 0
2, 1, 0, 0, 0, 0
...
10, 1, 0, 0, 0, 0
1 , 2, 0, 0, 0, 0
2 , 2, 0, 0, 0, 0
...
10, 2, 0, 0, 0, 0
...
...
10,10,10,10,10,10
Some repetition values are allowed, that is, if you have to
reset all values to begin the counting to another digit, etc.
Regards
Andre
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|