Question

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

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

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
In C++ program use the new style od C++ not the old one. Simple Battleship You...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Assignment - Battleship In 1967, Hasbro toys introduced a childrens game named “Battleship”. In the next...

    Assignment - Battleship In 1967, Hasbro toys introduced a childrens game named “Battleship”. In the next two assignments you will be creating a one-player version of the game. The game is extremely simple. Each player arranges a fleet of ships in a grid. The grid is hidden from the opponent. Here is an ASCII representation of a 10x10 grid. The ‘X’s represent ships, the ‘~’s represent empty water. There are three ships in the picture: A vertical ship with a...

  • For your Project, you will develop a simple battleship game. Battleship is a guessing game for...

    For your Project, you will develop a simple battleship game. Battleship is a guessing game for two players. It is played on four grids. Two grids (one for each player) are used to mark each players' fleets of ships (including battleships). The locations of the fleet (these first two grids) are concealed from the other player so that they do not know the locations of the opponent’s ships. Players alternate turns by ‘firing torpedoes’ at the other player's ships. The...

  • Imagine we are using a two-dimensional array as the basis for creating the game battleship. In...

    Imagine we are using a two-dimensional array as the basis for creating the game battleship. In the game of battleship a '~' character entry in the array represents ocean, a '#' character represents a place ion the ocean where part of a ship is present, and an 'H' character represents a place in the ocean where part of a ship is present and has been hit by a torpedo. Thus, a ship with all 'H' characters means the ship has...

  • i need to to create a battleship game in c++ using 2d array and functions the...

    i need to to create a battleship game in c++ using 2d array and functions the pograms has to be 10*10 and have 2 enemy ship and 2 friendly ships each taking 3 spaces randomly placed first the program would display the user the full ocean and the issuer would need to input cordinates and much check that the corinates are correct if not ask again . when a the two enemies ships are drestroyed the game ends or if...

  • I need help finishing my C++ coding assignment! My teacher has provided a template but I...

    I need help finishing my C++ coding assignment! My teacher has provided a template but I need help finishing it! Details are provided below and instructions are provided in the //YOU: comments of the template... My teacher has assigned a game that is similar to battleship but it is single player with an optional multiplayer AI... In the single player game you place down a destroyer, sub, battleship, and aircraft carrier onto the grid.... Then you attack the ships you...

  • C++ Programz

    Program 0 (50%): In many computer science courses, when you study sorting, you also study “runtime” - and it can be confusing to understand when you first see it.  For example, they say that BubbleSort “runs in O(n2)”  time (pronounced “Big-Oh of n-squared") - but what does that mean?  For simplicity, it means if you have n elements, the worst it could run would be n2 low-level computer operations (like comparisons, assignment statements and so on).  For example, if we...

  • c++ program Solitaire Battleship: I've posted in the pub/prog4 folder: AssignmentBase.cpp solution.o Since we aren't using...

    c++ program Solitaire Battleship: I've posted in the pub/prog4 folder: AssignmentBase.cpp solution.o Since we aren't using file i/o for this assignment, solution.o will be executable by default. Refer to previous assignments for instructions on copying down the provided files. You only have to write the bodies for the functions: displayBoard calculateAttack checkGameOver I have provided: main initBoard For this assignment you can change any code you want, I will only grade you on output. I don't mind if you change...

  • I haven't code in awhile and would like some help getting back on my feet. Need to code this in C++. Thank you! In...

    I haven't code in awhile and would like some help getting back on my feet. Need to code this in C++. Thank you! In this homework, you will implement a simple version of the game Battleship, in which the player tries to destroy ships hidden on a map using a system of coordinates. In this program, the map will be represented by a 4x4 matrix of integers. A 1 in the matrix represents the presence of a ship. There are...

  • First step is to draw a structure chart to help you understand the decomposition of functions...

    First step is to draw a structure chart to help you understand the decomposition of functions for this program. Remember to start with the overall problem and break it down into inputs, computations, and outputs. One possible functional decomposition includes the following (Note: you are NOT required to apply these functions in your program!):        Create a function welcome_screen() that displays an initial program welcome message along with the rules of Battleship.        Create a function initialize_game_board() that sets each cell in...

  • C#: Implement a multiplayer Battleship game with AI The rules are the same as before. The...

    C#: Implement a multiplayer Battleship game with AI The rules are the same as before. The game is played on an NxN grid. Each player will place a specified collection of ships: The ships will vary in length (size) from 2 to 5; There can be any number or any size ship. There may be no ships of a particular size; EXCEPT the battleship – which there will always be 1 and only 1. Player order will be random but...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT