Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <ctype.h>
- #include <time.h>
- int main ()
- {
- int i,diceRoll, sum1,sum2;
- char choice;
- for(i = 1; i<=100; i++);
- {
- diceRoll = (rand()%6) + 1;
- printf("%d", diceRoll);
- diceRoll+= sum1;
- }
- printf("\nSum is %d", sum1);
- printf("\n\nWill the next sum of dice rolls be higher, lower, or the same? (h/l/s)\n");
- scanf("%c", &choice);
- for (i=1 ; i<=3; i++);{
- diceRoll = (rand()%6) + 1;
- printf("%d", diceRoll);
- diceRoll+= sum2;
- }
- switch(choice){
- case('h'):
- printf("%s", (sum1<sum2) ? "Right" : "wrong");
- break;
- case('l'):
- printf("%s", (sum1>sum2) ? "Right" : "wrong");
- break;
- case('s'):
- printf("%s", (sum1==sum2) ? "Right" : "wrong");
- break;
- default:
- printf("Didnt get that");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement