# My Working Challenge #2

 Stacy Simmons · August 26, 2014 ``#include #include #include #include #include #include int main(){    int die1, die2, die3;    int total1, total2;    char guess, actual;    srand(time(NULL));    die1 = (rand() % 6) + 1;    die2 = (rand() % 6) + 1;    die3 = (rand() % 6) + 1;    total1 = die1 + die2 + die3;    printf("Your rolls were %d %d %d, making your total %d\n", die1, die2, die3, total1);    printf("Next roll: (h)igher, (l)ower or (s)ame?");    scanf(" %c", &guess);    die1 = (rand() % 6) + 1;    die2 = (rand() % 6) + 1;    die3 = (rand() % 6) + 1;    total2 = die1 + die2 + die3;    printf("Your next rolls were %d %d %d, making your total %d\n", die1, die2, die3, total2);    if (total2 == total1)    {        actual = 's';    }    else if (total2 > total1)    {        actual = 'h';    }    else    {        actual = 'l';    }    (guess == actual) ? puts("You win!") : puts("You lose!");    return 0;}``Edit to improve code appearance (meaning - I just discovered the "code button").

## Replies

 Minh Quan Vu · November 30, 2014 `` (guess == actual) ? puts("You win!") : puts("You lose!");``I dont understand this line. Can you explain for me please? Minh Quan Vu · November 30, 2014 Thanks adam wiedeman · December 10, 2014 Ha well done, that is perfect! Darsh Patel · December 21, 2014 I did not understand what did formula given below do:srand(time(NULL)); Minh Quan Vu · December 22, 2014 You will understand after watch this video @Darsh Patel:https://www.youtube.com/watch?v=0Nuhjvxzwro Darsh Patel · December 27, 2014 thanks
• 1

## C

120,709 followers