Home Forums Programming C programming Dice game problem? Reply To: C programming Dice game problem?


Right, some of the problems I’ve spotted:

You’re not initialising Points to be 0. This means it’s most likely filled with garbage data when you’re doing a Points = Points + value;

You can cut down on the if statements by doing

[code:1:6a5b75c2d7]if(RedDice == BlueDice) {
if(RedDice > 1 && RedDice < 6){
Points = 10;
} else {
Points = 5;

Because you’re not reusing Points at any stage, you don’t need to add to it, you can just assign.