Question
can someone help me fix my homework im trying to make it so you can say yes or no to roll or not #include #include
can someone help me fix my homework im trying to make it so you can say yes or no to roll or not
#include
///function to roll die /// returns number betweeen 1 to 6 int rollDie() { return (rand() % 6+1); }
/// function to ask optons to human void askYoNs(){ cout<<"Do you want to roll a dice (Y/N)?:"< ///function that takes arguments and prints scores void printScores(int turnTotal,int humanTotal,int compTotal){ cout<<"Your turn total is "< /// function to process current die roll /// turnTotal ,humanTotal and computerTotal are referrence args whose contents can be chnaged within the function int process(int& turnTotal,int roll,int curr_player,int& humanTotal,int& computerTotal) { if(roll==2 || roll==5) ///turn ends & turnTotal=0 { ///switch player curr_player=changePlayer(curr_player); turnTotal=0; printScores(turnTotal,humanTotal,computerTotal); } else if(roll==4) ///turn ends & turnTotal=15 { turnTotal=15; ///switch player if(curr_player==human) humanTotal+=turnTotal; else computerTotal+=turnTotal; curr_player=changePlayer(curr_player); turnTotal=0; printScores(turnTotal,humanTotal,computerTotal); } else{ ///roll = 1 3 6 turnTotal+=roll; cout<<"Your turn total is "< return curr_player; } void game() { int player=human; int humanTotal=0; int computerTotal=0; int turnTotal=0; if (turnTotal==0){ cout<<"Welcome to Jeopardy Dice!"< continue; } } else cout< }///while ends here ///check who is winner if(humanTotal>=80) { cout<<"Congratulations! human won this round of Jeopardy Dice!"< cout<<" !!! COMP WON !!! "< } } int main() { game(); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started