#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
typedef struct{
char name[50];
int score;
int result[5];
} Player;
Player a,b;
int main() {
int i;
srand(time(NULL));
strcpy(a.name, "player1");
strcpy(b.name, "player2");
a.score=0;
b.score=0;
for(i=0; i<5; i++){
a.result[i]=rand()%2;
b.result[i]=rand()%2;
a.score+=a.result[i];
b.score+=b.result[i];
}
printf("player1 score: %d\n",a.score);
printf("player2 score: %d", b.score);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: