Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- #include <math.h>
- int main(){
- int dice1;
- int dice2;
- int dice3;
- int dice4;
- int dice5;
- int dice6;
- int sum1;
- int sum2;
- char ready[2];
- char pogadjanje;
- 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");
- printf("Press ENTER when you're ready!");
- scanf("%c",ready);
- dice1 = (rand()%6)+1;
- dice2 = (rand()%6)+1;
- dice3 = (rand()%6)+1;
- printf("The first dice is: %d \nsecond one: %d \nand the third one is: %d",dice1,dice2,dice3);
- sum1 = dice1 + dice2 + dice3;
- printf("\nThe first sum is %d", sum1);
- dice4 = (rand()%6)+1;
- dice5 = (rand()%6)+1;
- dice6 = (rand()%6)+1;
- sum2 = dice4 + dice6 + dice5;
- printf("\nWhat do you think is the next sum going to be Higher(H), Lower(L) or Same(S):");
- scanf("%s", &pogadjanje);
- printf("The second sum is: %d\n", sum2);
- switch(pogadjanje){
- case 'H':
- if(sum1 > sum2){
- printf("Good job!");
- }else{
- printf("You suck");
- }
- break;
- case 'L':
- if(sum1 < sum2){
- printf("Good job!");
- }else{
- printf("You suck!");
- }
- break;
- case 'S':
- if(sum1 == sum2){
- printf("Woah you're correct!");
- }else{
- printf("You suck!");
- }
- break;
- default:
- printf("Dude really? I said H, L, or S nothing else!\nYou blind fuck");
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement