Question: THIS IS A C++ CODE. Program the game of battleship against the computer. Each side has 2 grids. The first grid contains the location of

THIS IS A C++ CODE.

Program the game of battleship against the computer. Each side has 2 grids. The first grid contains the location of the players ships. The second grid contains the location of the players shots and the outcome of the shot (hit or miss). The objective is to hit and sink all 5 enemy ships before they do the same to you. Each side recieves ships listed in figure 1.

Add statements to the main() function to do the following:

The grids are 10 x 10 squares.

Use whatever method is expedient to generate the computer

moves; this isnt an AI class.

Constraints.

Filter the input for valid numbers. Use Object Oriented Programming techniques. Use a Ship class. Use an assert to protect at least two of your methods.

1)show how many turns you took to win.

carrier size-5

Battleship size-4

crusier size- 3

submarine size- 3

destroyer size- 2

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!