team combinations

S

Stephen

I'll try to explain as best I can what I am trying to do.
1v 2.00 1t 3.20 1h 1.90
2v 1.90 2t 3.20 2h 2.10
3v 1.80 3t 3.20 3h 1.90
4v 1.90 4t 3.20 4h 2.60
..........
..........

These are the games that are being played, usually there are between
10 - 14 games being played each day, so the amount of games vary. I
want to wheel these into 3 game parlays. Example:
1v 2v 3v = (2.00 * 1.90 * 1.80)
1v 2v 4v = (2.00 * 1.90 * 1.90)
1v 2v 3t = etc...
1v 2v 3h = etc...
1v 2v 4t
1v 2v 4h
1t 2v 3v
1t 2v 4v
etc...

The user would enter the games being played that day (10 - 14 games),
then the program will output every possible combination of 3 along
with the odds for that parlay. Can someone give me a hint on how to do
this. I'm still a beginner in C, so go easy on me!

Thanks
Steve
 
D

David Rubin

Stephen wrote:

[snip]
The user would enter the games being played that day (10 - 14 games),
then the program will output every possible combination of 3 along
with the odds for that parlay. Can someone give me a hint on how to do
this. I'm still a beginner in C, so go easy on me!

Write a program that takes a set of values as input and prints the
specified combinations. The is called "choose" as in "given N elements,
choose a subset of K elements." You want all subsets such that each
subset is unique with respect to permutation (i.e., {1,2,3}, {1,3,2},
{3,1,2}, and {3,2,1} are all the same). This is fairly easy to do using
a bit-vector and a "rotor" to crank through all the possible
combinations (similar to an odometer in a car). There is code on the
web, and possibly in the clc archives.

After you have the subsets, you just combine the appropriate data which
you read in from your input file.

/david
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top