Question: using c++ turn this code from java to OOP This task, you will create game Bars 21 or Sticks 21. There are 21 Bars and

using c++ using c++ turn this code from java to OOP This task, you

turn this code from java to OOP This task, you will create game Bars 21 or Sticks 21. There are 21 Bars and two players A and B) in this game. The program must randomly select who is the first player (A or B). Each player can pick up the bars or sticks only 1.2 or 3. The player who picks up the ast bar(s) will loss in the game. The program MUST detect the entor and let player to pick the appropriate number of bars sticks) as shown in: import java.util. public class Main public static void main(String args Random rand new Random System.out.println("Bars 21 Game, each player picks 1.2 or 3 bars"); int randomrand.netin23-1: W/ Random number to choose first player char player1.player2 ifrandom) player = 'A: player2=8 1 else { player1=''; player2A: int Bars = 21: while Bars Bars> System.out.print("Bars Bars + Player + player1 + ' Picks: int n = rand.next Math.min Bars 32+1; Random number to choose the number of sticks. System.out.printing Barsan 1 elsel System.out.println("Player + player2+ Wint" break; 1 BarsOX System.out.print("Bars Bars Player player2 Picks: int nrand nextin Math.min(Bars.30-1: Will Random number to choose the number of sticks System.out.printinin Bars-on: 1 else System.out.println("Player player2 + Win": break

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!