C challenge #2 solved by Divulger

 Divulger Michealson · August 9, 2015 #include #include int main(){    int i;    int bet;    int bet2, bet3, bet4, bet5;    int bet1;    int total;    float sum, sum1;    char a,b,c, val;for(i=1; i>=1; i++){        printf("This Is Dice Betting Game 'Q' to quit When finish\n\n");            bet = ( rand()%6 ) + 1;            bet1 = ( rand()%6 ) + 1;            bet2 = ( rand()%6 ) + 1;            printf("Hit 'R' Below To Roll your Dice no more than One Roll per 'R'\n\n");            scanf(" %c", &a);             printf(" %d\n", bet);             printf("Hit 'R' Below To Roll your Dice no more than One Roll per 'R'\n\n");              scanf(" %c", &b);               printf(" %d\n", bet1);               printf("Hit 'R' Below To Roll your Dice no more than One Roll per 'R'\n\n");                scanf(" %c", &c);                 printf(" %d\n", bet2);            printf("R = %d, %d, %d\n\n", bet,bet1,bet2);    printf("===========================================================\n\n");    sum = ((float)bet+(float)bet1+(float)bet2) / 3;    printf("Do You Think The Next Set Of Rolls Will Be Higher, Lower, Or The Same\n\n");    printf("If Higher Enter 'H or h',Lower Enter 'L or l',Same Enter 'S or s'\n\n");    scanf(" %c", &val);            bet3 = ( rand()%6 ) + 1;            bet4 = ( rand()%6 ) + 1;            bet5= ( rand()%6 ) + 1;            printf("Hit 'R' Below To Roll your Dice no more than One Roll per 'R'\n\n");            scanf(" %c", &a);             printf(" %d\n", bet3);             printf("Hit 'R' Below To Roll your Dice no more than One Roll per 'R'\n\n");              scanf(" %c", &b);               printf(" %d\n", bet4);               printf("Hit 'R' Below To Roll your Dice no more than One Roll per 'R'\n\n");                scanf(" %c", &c);                 printf(" %d\n", bet5);                          printf("R = %d, %d, %d\n\n", bet3,bet4,bet5);    printf("===========================================================\n\n");    sum1 = ((float)bet3+(float)bet4+(float)bet5) / 3;    printf("SUM = %.2f\n", (float)sum);     printf("SUM1 = %.2f\n", (float)sum1); printf("===========================================================\n\n");    if( (val == 'H')||(val=='h') ){            if(sum1>sum){                printf("You Were Correct Indeed\n\n");                printf("===========================================================\n\n");            }else{                printf("Good Try But You Were incorrect\n\n");                printf("===========================================================\n\n");            }    }else if( (val=='L')||(val=='l') ){           if(sum1

Replies

Nothing to see here.

C

129,986 followers