I'm trying to make the game cho-han bakuchi in C. It is very simple, the Japanese game consists of throwing two 6-sided dice in a cup, before the dice are shown the player makes the bet saying cho (pairs) or han (odd). Then it shows the data and the values are summed.
What am I missing in my code?
I would not like the full code, just from the point where I'm making a mistake.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,x,apost,cred=100,result=0;
while(apost!=EOF)
{
printf("faça a aposta:(digite -1 para sair)\n");
scanf("%d", &apost);
cred=cred-apost;
printf("escolha 1-cho(par) 2-han(impar):\n");
scanf("%d", &x);
switch(getc(x))
{
case 1:
i=2+rand()%12;
printf("\n%10d", i);
if(i%2==0)
{
printf("ganhou!\n");
cred=cred+(apost*2);
}
else
printf("perdeu!");
break;
case 2:
i=2+rand()%12;
printf("\n%10d", i);
if(i%2!=0)
{
printf("ganhou!\n");
cred=cred+(apost*2);
}
else
printf("perdeu!");
}
}
return 0;
}