Advertisement
Guest User

uhm

a guest
Jan 26th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.70 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <math.h>
  6.  
  7. int main(){
  8.     int dice1;
  9.     int dice2;
  10.     int dice3;
  11.     int dice4;
  12.     int dice5;
  13.     int dice6;
  14.     int sum1;
  15.     int sum2;
  16.     char ready[2];
  17.     char pogadjanje;
  18.     printf("Hello, welcome to the dice challenge 4k.\nIn this game you roll 3 dices and they add up together.\nAfter that the sum will be printed out and you have to quess \nif the next sum is going to be Higher(H), Lower(L) or Same(S)\n");
  19.     printf("Press ENTER when you're ready!");
  20.     scanf("%c",ready);
  21.     dice1 = (rand()%6)+1;
  22.     dice2 = (rand()%6)+1;
  23.     dice3 = (rand()%6)+1;
  24.     printf("The first dice is: %d \nsecond one: %d \nand the third one is: %d",dice1,dice2,dice3);
  25.     sum1 = dice1 + dice2 + dice3;
  26.     printf("\nThe first sum is %d", sum1);
  27.     dice4 = (rand()%6)+1;
  28.     dice5 = (rand()%6)+1;
  29.     dice6 = (rand()%6)+1;
  30.     sum2 = dice4 + dice6 + dice5;
  31.     printf("\nWhat do you think is the next sum going to be Higher(H), Lower(L) or Same(S):");
  32.     scanf("%s", &pogadjanje);
  33.     printf("The second sum is: %d\n", sum2);
  34.     switch(pogadjanje){
  35.      case 'H':
  36.     if(sum1 > sum2){
  37.         printf("Good job!");
  38.     }else{
  39.     printf("You suck");
  40.     }
  41.     break;
  42.      case 'L':
  43.         if(sum1 < sum2){
  44.             printf("Good job!");
  45.         }else{
  46.         printf("You suck!");
  47.         }
  48.         break;
  49.      case 'S':
  50.         if(sum1 == sum2){
  51.             printf("Woah you're correct!");
  52.         }else{
  53.         printf("You suck!");
  54.         }
  55.     break;
  56.      default:
  57.         printf("Dude really? I said H, L, or S nothing else!\nYou blind fuck");
  58.     }
  59.     system("pause");
  60.     return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement