Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program Description: In this project, you will write a C++ program that simulates a modified version of the board game Battleship In this version there
Program Description: In this project, you will write a C++ program that simulates a modified version of the board game Battleship In this version there will only be one player who will try to find three ships, a Destroyer, a Submarine, and a Battleship. The program will randomly place three ships somewhere on the 7x7 grid board (i.e. the ocean) The Destroyer take-up two positions in the 7x7 grid, whereas the Submarine takes-up three positions, and the Battleship takes-up four. Ships can only be place horizontally or vertically on the 7x7 grid. The program should operate as follows: 1) The program should first create the 7x7 grid (ocean) and randomly place the three ships somewhere into this grid. The program should randomly select the orientation (i.e. vertical or horizontal) of each ship and its location. Be sure that the the three ships do not overlap The program should then display the 7x7 grid and prompt the user to enter the coordinates of their guess (see below-left). If the coordinates are NOT within the range of acceptable values (i.e. column 1-7 and row A-G), the program should display an error message (see below-right). location selected permits the placement of the ship into that location and that 2) Bettle-Ship Bettle-Ship 12131415161 7 121 314151617 nter Your Guess (C 1-71 R [A-G1] Enter Your Guess (C [1-71R [A-G]] :8 Fornat Errer.. Please Reenter any key to continue Program Description: In this project, you will write a C++ program that simulates a modified version of the board game Battleship In this version there will only be one player who will try to find three ships, a Destroyer, a Submarine, and a Battleship. The program will randomly place three ships somewhere on the 7x7 grid board (i.e. the ocean) The Destroyer take-up two positions in the 7x7 grid, whereas the Submarine takes-up three positions, and the Battleship takes-up four. Ships can only be place horizontally or vertically on the 7x7 grid. The program should operate as follows: 1) The program should first create the 7x7 grid (ocean) and randomly place the three ships somewhere into this grid. The program should randomly select the orientation (i.e. vertical or horizontal) of each ship and its location. Be sure that the the three ships do not overlap The program should then display the 7x7 grid and prompt the user to enter the coordinates of their guess (see below-left). If the coordinates are NOT within the range of acceptable values (i.e. column 1-7 and row A-G), the program should display an error message (see below-right). location selected permits the placement of the ship into that location and that 2) Bettle-Ship Bettle-Ship 12131415161 7 121 314151617 nter Your Guess (C 1-71 R [A-G1] Enter Your Guess (C [1-71R [A-G]] :8 Fornat Errer.. Please Reenter any key to continue
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started