Question: this is the a Yahtzee code in C++ ,,, how i make it work in c++ shell without any errors and also i want to
this is the a Yahtzee code in C++ ,,, how i make it work in c++ shell without any errors and also i want to change how the dice look in this code (i need just to look like [dice1 is 5] - [dice2 is 4] - [dice3 is 6] and so on .....)
here the explaination how the code work ,, https://www.youtube.com/watch?v=fDVvWuo7qQw
#include "Header.h"
int main() { int x; int y; int count = 0; string com = "nope"; int apply = 0; int points = 0; int round = 0; int roll1 = 1; int roll2 = 1; int roll3 = 1; int roll4 = 1; int roll5 = 1; int one; int two; int three; int four; int five; int ones=0; int twos=0; int threes=0; int fours=0; int fives=0; int sixes=0; int toak=0; int foak=0; int fullhouse=0; int small=0; int large=0; int extra=0; int yahtzee=0; int total=0; string onepic = " ------- | | | | | o | | | | | ------- \t"; string twopic = " ------- | | | o | | | | o | | | ------- \t"; string thrpic = " ------- | | | o | | o | | o | | | ------- \t"; string foupic = " ------- | | | o o | | | | o o | | | ------- \t"; string fivpic = " ------- | | | o o | | o | | o o | | | ------- \t"; string sixpic = " ------- | | | o o | | o o | | o o | | | ------- \t"; while(round!=13) { count++; srand (time(NULL)); if(roll1==1) { for(int i=0;i<30;i++) { x=rand(); if(i==25) { one=x%6+1; } } } if(roll2==1) { for(int i=0;i<30;i++) { x=rand(); if(i==25) { two=x%6+1; } } } if(roll3==1) { for(int i=0;i<30;i++) { x=rand(); if(i==25) { three=x%6+1; } } } if(roll4==1) { for(int i=0;i<30;i++) { x=rand(); if(i==25) { four=x%6+1; } } } if(roll5==1) { for(int i=0;i<30;i++) { x=rand(); if(i==25) { five=x%6+1; } } } if(one==1) cout< else if(one==2) cout< else if(one==3) cout< else if(one==4) cout< else if(one==5) cout< else if(one==6) cout< if(roll1==0) cout<<"HELD"; cout< if(two==1) cout< else if(two==2) cout< else if(two==3) cout< else if(two==4) cout< else if(two==5) cout< else if(two==6) cout< if(roll2==0) cout<<"HELD"; cout< if(three==1) cout< else if(three==2) cout< else if(three==3) cout< else if(three==4) cout< else if(three==5) cout< else if(three==6) cout< if(roll3==0) cout<<"HELD"; cout< if(four==1) cout< else if(four==2) cout< else if(four==3) cout< else if(four==4) cout< else if(four==5) cout< else if(four==6) cout< if(roll4==0) cout<<"HELD"; cout< if(five==1) cout< else if(five==2) cout< else if(five==3) cout< else if(five==4) cout< else if(five==5) cout< else if(five==6) cout< if(roll5==0) cout<<"HELD"; cout< if(count==3) com="roll"; cout< while(com!="roll") { cout<<"Command: "; cin>>com; if(com=="hold1") roll1=0; if(com=="hold2") roll2=0; if(com=="hold3") roll3=0; if(com=="hold4") roll4=0; if(com=="hold5") roll5=0; if(com=="unhold1") roll1=1; if(com=="unhold2") roll2=1; if(com=="unhold3") roll3=1; if(com=="unhold4") roll4=1; if(com=="unhold5") roll5=1; if(com=="holdall") { roll1=0; roll2=0; roll3=0; roll4=0; roll5=0; } if(com=="unholdall") { roll1=1; roll2=1; roll3=1; roll4=1; roll5=1; } } com="nope"; if(count==3) { count=0; cout<<" 1) 1s: "<
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
