This is a fun project which is made in C++ and is played by a single player. The other player is the computer itself. The player who scores more runs while batting is the winner.
The code below contains, include, include libraries which are used to make the output in the console look more attractive and to generate the random numbers for the computer player respectively.
Execution of the program:
1. After starting the program, the main menu is displayed on the console.
2. If you start a new game, first you have to choose the format of the game.
3. Then you have to choose Heads or tails for the toss. The player who wins the toss has to choose what he will be doing for the first innings i.e., Batting or Bowling.
4. During batting, the player has to choose a number between 1 and 6, also that number should be different from the number chosen by the bowler. If both bowler and batsmen chose the same number, the batsmen are considered to be OUT.
5. The player who scores more runs during their batting is considered to be WINNER.
6. If you want to see the instructions, select the second option in the main menu.
Submitted by Akshay Sai Reddy Kondu (akshaysrkondu)
Download packets of source code on Coders Packet