#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void main()
{
	int myrand;
	int low = 0;					//lowest of range
	int high = 1;					//highest of range
	srand(time(NULL));				//seed randomness
	int coin,i,computerscore=0,userscore=0;
	char guess;
	coin = rand() % (high - low + 1) + low;

	for (i = 0;i < 5; i++)
	{

		printf("Please enter your guess (h or t): ");
		scanf(" %c", &guess);

		if (guess == 'h' && coin == 0)
		{
			printf("You won!\n\n");
			userscore = userscore + 1;
		}
		else if (guess == 't' && coin == 1)
		{
			printf("You won!\n\n");
			userscore = userscore + 1;
		}
		else
		{
			printf("You didn't win this time :(\n\n");
			computerscore = computerscore + 1;
		}
	}
	printf("Final scores were: Computer: %d User: %d\n\n", computerscore, userscore);
}
