Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone help me fix this #include #include using namespace std; int player; int human=0; int rollDie() { return (rand() % 6+1); } void askYoNs()

can someone help me fix this

#include #include using namespace std; int player; int human=0; int rollDie() { return (rand() % 6+1); }

void askYoNs() { cout<<"Do you want to roll a dice (Y/N)?:"<

void printScores(int turnTotal,int humanTotal,int compTotal) { if(player==human) { cout<<"Your turn total is "<

int changePlayer(int player) { if(player==human) return 1; return human; } int process(int& turnTotal,int roll,int curr_player,int& humanTotal,int& computerTotal) { if(roll==2 || roll==5) { curr_player=changePlayer(curr_player); turnTotal=0; printScores(turnTotal,humanTotal,computerTotal); } else if(roll==4) { 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 "<=10 ///then switch player if(curr_player!=human && turnTotal >=10 ) { computerTotal+=turnTotal; curr_player=changePlayer(curr_player); turnTotal=0; printScores(turnTotal,humanTotal,computerTotal); } 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!"<>YoN; if(YoN=='Y') { roll=rollDie(); cout<<"You rolled a "<=80){ cout<<"Congratulations! human won this round of Jeopardy Dice!"<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions

Question

1. Adapt the three-step writing process to reports and proposals.

Answered: 1 week ago