Alternative to if, else if statements

I'm working on a gambling project and need a way to narrow down the odds to what the user would expect to see. The only way I've been able think of so far is with about 20 if/else if statements involving the range of the computed odds. Currently I get:

The odds on horse 1 are 3.25 : 1
and pays $8.50
The odds on horse 2 are 0.70 : 1
and pays $3.40
The odds on horse 4 are 1.83 : 1
and pays $5.67

The odds should be 3:1, 9:5, and 3:2 respectively. The payout needs to round down to the dime, but that's a different question and isn't going to be part of this function anyway (I only have it to validate the odds and 9:5 might be wrong looking closer at the second one). Anyway, I'm looking at having to go through 20 or more if/if else statements, every time a bet is made. There must be a cleaner way to do this, but I haven't been able to think of it yet so I'm looking for ideas. Bellow is my function as it stands now.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  void Race::calcOdds()
{
	addPool();

	m_percent = m_totWin * take;				// Get take amount
	m_tempPool = m_totWin - m_percent;			// Subtract take from total

	for(int i = 0; i < 12; i++)
	{
		if(m_winPool[i] == 0)
		{
			continue;
		}
		m_horsePool = m_tempPool - m_winPool[i];	// Subtract horse amount from new total
		m_odds[i] = m_horsePool / m_winPool[i];		// Divide by horse amount
		cout << "The odds on horse " << i + 1 << " are " << fixed << setprecision(2) << m_odds[i] << " : 1\n";
		cout << "and pays $" << fixed << setprecision(2) << ((m_odds[i] * 2) + 2) << '\n';
	}
}


This needs work also, but adding
 
if(m_odds[i] > something && m_odds[i] < something) {m_odds[i] = displayOdds};

20 plus times is a bit much. I'm thinking create an abstract class, but not sure how to go about it just to do the rounding or if that would be a better way. Any suggestions are appreciated.
Topic archived. No new replies allowed.