I'm making a simple roll the dice game that displays your the winner if you roll a 7 or 11.
But my 'OR' operator doesn't seem to be working.
It always displays your the winner regardless the roll of the dice.
If I remove the || and 11 it works fine.
This is kinda driving me nuts, it should be real simple
Code:
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
int dice_1 = 0;
int dice_2 = 0;
int rollDice = 0;
time_t t;
srand(time(&t));
dice_1 = (rand() % 6) + 1;
dice_2 = (rand() % 6) + 1;
rollDice = dice_1 + dice_2;
if (rollDice == 7 || 11){
printf("You lucky bastard! You rolled a %d\n", rollDice);
}
else {
printf("Your roll was %d ,you lose try agian.\n", rollDice);
}
return 0;
}