Question: In C++ program use the new style od C++ not the old one. Simple Battleship You will make a game similar to the classic board

In C++ program use the new style od C++ not the old one.

Simple Battleship

You will make a game similar to the classic board game Battleship. You will set up a 5 x 5, 2 dimensional array. In that array, you will use a random number generator to select 5 elements that will act as the placeholders for your "battleships". Your user will get 10 guesses to "seek and destroy" the battleships. After their 10 guesses, you will tell them how many ships they found. At some point during the program, you will need to display the game board (this is to assess your ability to traverse a 2 dimensional array).

Sample output (your program may vary in approach):

_______________________________

Welcome to Battleship! You have 10 chances to sink the 5 Battleships.

Enter a coordinate: 2 3 That is a miss! Enter a coordinate: 4 1 That is a hit! There are 4 remaining ships. Enter a coordinate: 5 5 That is a miss! Enter a coordinate: 3 2 That is a miss! Enter a coordinate: 1 1 That is a hit! There are 3 remaining ships. Enter a coordinate: 2 4 That is a miss! Enter a coordinate: 3 5 That is a miss! Enter a coordinate: 4 5 That is a miss! Enter a coordinate: 1 3 That is a hit! There are 2 remaining ships. Enter a coordinate: 3 3 That is a miss! You hit 3 out of 5 ships. ------------------------------------ 2 0 2 0 0 0 0 -1 -1 0 0 -1 -1 1 -1 2 0 0 -1 0 0 0 0 1 -1

2 = Hit, 1 = Ship, -1 = Missed shot

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!