Open ankytastic opened 1 year ago
int game(char you, char computer) {
if (you == computer)
return -1;
if (you == 's' && computer == 'p')
return 0;
else if (you == 'p' && computer == 's') return 1;
if (you == 's' && computer == 'z')
return 1;
else if (you == 'z' && computer == 's')
return 0;
if (you == 'p' && computer == 'z')
return 0;
else if (you == 'z' && computer == 'p')
return 1;
}
int main() {
int n;
char you, computer, result;
srand(time(NULL));
n = rand() % 100;
if (n < 33)
computer = 's';
else if (n > 33 && n < 66)
computer = 'p';
else
computer = 'z';
printf("\n\n\n\n\t\t\t\tEnter s for STONE, p for PAPER and z for SCISSOR\n\t\t\t\t\t\t\t");
scanf("%c", &you);
result = game(you, computer);
if (result == -1) {
printf("\n\n\t\t\t\tGame Draw!\n");
}
else if (result == 1) {
printf("\n\n\t\t\t\tWow! You have won the game!\n");
}
else {
printf("\n\n\t\t\t\tOh! You have lost the game!\n");
}
printf("\t\t\t\tYOu choose : %c and Computer choose : %c\n",you, computer);
return 0;
}
Please assign me with this issue
hello i want to work for the issue would u like this to be assigned let me know please
Please assign me on this, I will do it as soon as possible
I would like to add rock,paper and scissor program in C in this repo.Please assign me this issue and label with hacktoberfest-accepted