Trouble with code

Please can someone tell me where do I go wrong with this code it won't run.

//*****************************************************************************
// GAME: ROCK PAPER SCISSORS
// In this game ,the user and the
//Computer choose one option between
//rock,paper scissors
// stone wins over scissors
//scissors win over paper
//and paper over stone
//*****************************************************************************

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

#define WINSCORE 3

//Function MachineChoice (pick at random)
// Mchine Return a random selection between
// (r)ock,(p)aper,(s)cissors

char machinechoice (void)
{
char option;

//srand (time(NULL));// Tell machine to reintialized random number generator
//int value=rand()%3; // Machine generate numbers from 0 to 2

//*****************************************************************************

srand (time(NULL));
int value=rand()%3; // Machine generate numbers from 0 to 2
switch(value){
case 0: option='r';
break;

case 1: option='p';
break;

case 2: option='s';
break;

}// close switch

return option;

}//close machinechoice main


//*****************************************************************************


// Play game function and Scores

//whowins function
//check which choice wins
// 0=tie,1=the first,2=the second,-1 is error


int WhoWins (char a,char b)
{
switch (a)
{
case'r':
if(b=='s')return 1;
else if(b=='p') return 2;
else return 0;


case 'p':
if(b=='r') return 1;
else if (b=='s') return 2;
else return 0;


case 's':
if(b=='p') return 1;
else if(b=='r')return 2;
else return 0;
default:
return-1;

}//end switch


// No break enter here this function has no ending

}
main ()

{

char you ,machine ;
int machinepoints=0;
int yourpoints=0;
int winner;

do {
//prompt player.
printf("\n Please enter r,p,s");
printf("r=rock,p=paper,s=scissor");
scanf("%c",&you);


//Machine tell its option
machine=machinechoice();
printf(" I say %c\n",machine);

//checking who win
winner=WhoWins( you,machine);

//Show appropriate message:

if (winner==0)
printf("Tied\n");
else if(winner==1); {
printf("You win\n",yourpoints++); }
else if(winner==2) {
printf("I win\n",machinepoints++); }
else {
printf("Sorry you entered an invalid option\n"); }


// Tally of Scores

/* printf("Points:you:",yourpoints);
printf("Machine",machinepoints); */


}
while (yourpoints<WINSCORE&&machinepoints<WINSCORE);
if (yourpoints>machinepoints){
printf("You win !\n");
}
else{
{printf("I win !\n"); }

return 0;
}

}













What isn't working?
Topic archived. No new replies allowed.