Hey all, I've been programming for a while, and I can't seem to figure out this little error.
Code:
#include <iostream>
int main()
{
int Players = 12; //12 Players
float PChances[Players]; //Each Player has his/her own chance to draw shooter
float PreviousChances = 0;
int y = 12;
for(int x = 0; x < 12; ++x)
PChances[x] = 0;
for(int x = 0; x < 12; ++x)
{
if(y > 0)
PChances[x] = ( 1/y ); //Keeps returning as 0
std::cout << 1/y;
--y;
}
if(PChances[3] > 0)
std::cout << "TRUE";
std::cin.get();
}
The output is:
000000000001
Anything below 12 is resulting in 0
If you can tell me why 1/y is always equaling 0 i would appreciate it greatly.