File.exe has stopped working...

When x == 14, the program crashes. why?

Assume x == 14:

1
2
3
4
5
6
...
if (x>=14) {
a = x -14;
a = rand() %a +5;
b = rand() %2;
...

You're trying to divide by zero at a = rand()%a, because a is assigned 0 (14 - 14) at line 3. (This isn't windows related btw)
Last edited on
Oops, I assumed because of the windows OS and all...
Topic archived. No new replies allowed.