C
c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#define MR_BEAN 100
// since there is no built-in functions for capitalize in C in ctype, ill create my own
void capitalize(char *str) {
if (str[0] != '\0') {
str[0] = toupper(str[0]);
for (int i = 1; str[i] != '\0'; i++) {
str[i] = tolower(str[i]);
}
}
}
const char* mrBean_choices() {
const char* choices[] = {"Rock", "Paper", "Scissors"};
return choices[rand() % 3];
}
// thanks a lot to BroFar for reported the issue!
const char* determine_round_winner(const char* choice1, const char* choice2) {
if (strcmp(choice1, choice2) == 0) return "Tie";
if ((strcmp(choice1, "Rock") == 0 && strcmp(choice2, "Scissors") == 0) ||
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run