This is homework, i have the code mostly complete but am receiving a compile error that I can not figure out. any help would be appreciated. the error at compile is E2379 line 39
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main ()
{
int i,d1,d2,sumd,sumd2;
double winf = 0, lossf = 0, winp = 0, lossp = 0;
printf("This program will simulate the game of craps for 100 times.\n");
for (i=0; i<100; i++)
{
d1 = rand()%6+1;
d2 = rand()%6+1;
sumd = d1 + d2;
if (sumd==7 || sumd==11)
{
winf++;
}
if (sumd==2 || sumd==3 || sumd==12) {
lossf++;
}
if (sumd==4 || sumd==5 || sumd==6 || sumd==8 || sumd==9 || sumd==10) {
while (1)
{
d1 = rand()%6+1;
d2 = rand()%6+1;
sumd2 = d1 + d2;
if (sumd2>=sumd)
{
printf("Win by points.\n");
winp++;
break;
}
else ((d1==7) || (d2==7))
{
printf("You rolled a 7, you lose.\n");
lossp++;
break;
}
}
}
}
printf("First roll wins: %lf\n", winf);
printf("First roll losses: %lf\n", lossf);
printf("Points wins: %lf\n", winp);
printf("Points losses: %lf\n", lossp);
return 0;
}