doing a code comparing various cases,
int mov = rand()% 7+1;
switch(mov){
case 1:
machine = "condition 1";
break;
case 2:
machine = "condition 2";
break;
and some more cases from 1 to 7 and then I have the if
if (player == mov){
cout << "draw";
the one I don't know is the next part to see if I can simplify my code or not. Can I do
} else if ((player == 1) && (mov == 3) && (mov == 4)){
cout << "wining message";
or do I have to do it like
} else if ((player == 1) && (mov == 3)){
cout << "wining message";
} else if ((player == 1) && (mov == 4)){
cout << "wining message";
Aucun commentaire:
Enregistrer un commentaire