Code:
include <stdio.h>
#include <stdlib.h>
#include <time.h>
main(){
int rollADie;
int rollADie2;
int comeOutRoll;
int count;
int thePoint;
int newTotal;
srand(time(NULL));
count=0;
thePoint=0;
rollADie=rand()%6+1;
rollADieA=rand()%6+1;
comeOutRoll=rollADie+rollADie2;
printf("%i\n",rollADie);
printf("%i\n",rollADie2);
printf("%i\n",comeOutRoll);
if (comeOutRoll == 7)
{printf("Winner\n");}
else if (comeOutRoll == 11)
{printf("Winner\n");}
else if (comeOutRoll ==2)
{printf("You loose\n");}
else if (comeOutRoll ==3)
{printf("You loose\n");}
else if (comeOutRoll ==12)
{printf("You loose\n");}
else
{printf("You might have a chance \n");
thePoint=comeOutRoll;
printf("The point is %i\n",thePoint);
do
rollADie=rand()%6+1;
rollADie2=rand()%6+1;
newTotal=rollADie+rollADie2;
printf("The new random is %i\n",newTotal);
if (newTotal ==thePoint)
{printf("You win \n");}
else if (newTotal==7)
{printf("You loose\n");}
else
{printf("Nothing\n");}
count++;
while (newTotal != thePoint && newTotal != 7);
}
printf("The answer worked\n");
system ("Pause");
}