Without looking at your code, I'm sure your cars slow down. Suppose they reach a speed -- let's say 20. You make them slow down by 5. Now they are at 15. Did you make sure to slow them down further, are they accelerating again or did you simply let them continue at 15?
Edit: At first glance, it appears to me that your code in `raceDone()' and `main()' suggests that your logic is backward:
I want to make the cars slow down by a random nr from 1 to 5 until velocity=0,
something like a for-loop or a while that looks something like
while(velocity!=0)
{
stopAllCars(cars,n);
showCars(cars,n);//not needed, the cars need to slow down but not to be show on the screen
system("pause");//its only for me so i see that they really slow down.
}
I know that this kind of while wont work but thats what i would like to accomplish.
The thing you wanted me to change makes the program end, wont even start increasing the speed to "20", like before.