# Thread: Keeping Floating Numbers From Converting

1. ## Keeping Floating Numbers From Converting

I am writing a program that gives the user a number depending on the inputs they enter. In my matrix the numbers are entered in as floating numbers and when I run the program it converts the floating numbers to integers. How do I keep this from happening? I am still new to this. Thanks for the help.

2. are you storing the numbers in an integer type?
how are you printing the numbers to confirm that this is actually happening?

3. You are probably calling something that takes an integer and passing it a float.
Something like SetDlgItemInt perhaps, which clearly takes an int?

You'll need to show us some relevant bits of code.

4. This is the part of my code where I have the floating numbers entered in my array.
Code:
```
#include <iostream>
using namespace std;
int main()
{int opponents, odds;
char firstcard, secondcard, handsuit;
float pokerhandoddspreflop [2][9];
pokerhandoddspreflop [0][0] = 0.2;
pokerhandoddspreflop [0][1] = 0.4;
pokerhandoddspreflop [0][2] = 0.6;
pokerhandoddspreflop [0][3] = 0.8;```
This isnt all of the entries for the matrix, but it gives you an idea of what I am entering.
Here is the part where I am having the if loops run and the values displayed.
Code:
```if ( opponents == 1 && firstcard == 'A' && secondcard == 'A' && handsuit == 'o' ){
odds = pokerhandoddspreflop [0][0];
}
if ( opponents == 1 && firstcard == 'A' && secondcard == 'A' && handsuit == 's' ){
odds = pokerhandoddspreflop [0][0];
cout << "Your pre-flop odds of winning with " << firstcard << secondcard << handsuit << " against " << opponents << " opponents are " << odds << " to 1" <<endl;```
I thought I wrote this correctly to display the value in the matrix but I'm not sure whats going on. Any help or suggestions would be greatly appreciated. Thanks

5. Well odds is an int and in this line you are triggering an implicit conversion:
Code:
`odds = pokerhandoddspreflop [0][0];`
You do this at least twice in the code you provided; since odds is an int, it has no choice but to be an int. Gawd that sounded almost zen...