2-boat Homework Help & Answers - Studypool

Fast Reliable 2-boat Answers.

Questions, Assignments & Papers. Get Answers from Premium Tutors.

Register Free Account

Studypool, a California Company


Receive help quickly. Choose your own delivery time.


Make questions 100% private & anonymous.


Get quality help from verified tutors.


Tutors can help with everything ...

  • Questions

    and more...

  • Homework Assignments
    Discussion Questions
    Lab Reports
    Problem Sets

    and more...

  • Concepts
    Game Theory

    and more...

  • Papers
    Thesis Statements

    and more...

  • Study guides
    Practice Quizzes

    and more...

  • & anything else ...
    Graphic Design
    Logo Design

    and more...


Program 5: Battleship: This program is a one-player version which enables a user to play Battleship with the computer; it will be written as a class g the class examined some of the algorithm steps needed. Initial Set-up: the computer needs a 10 by 10 “ocean” grid storing where its boats are found. E or the computer could read in data for its ocean grid. User communication: Software should be user-friendly. The user refers to a grid square using a March 30 and a column index from 0 to 9. We will write a function maybe void location(char ch int num int& row int& col) which will convert user input to the needed array index values. Before the user inputs a shot (fires a torpedo) the user sees the 10x10 ocean grid with each square showing either ocean a missed shot or a previous hit. The hit square tells which type of ship (1-boat 3- boat 4-boat or 5-boat) was hit there. The primary loop: (1) User inputs grid square where torpedo is sent. Increment number of shots. (2) Hit or miss: If it is a tell the user and designate the miss in the grid. (3) If it is a hit tell the user which boat was hit and designate the hit for that boat in the grid. (3a) Test whether the boat was sunk (all positions have been hit); i report it sunk and (3b) test for Game Over (all boats sunk). Repeat the loop until done; report the number of shots made by the user. Design decision: Grid Array – A the class decided to use the following data structures for the project. There will be two parallel arrays for the 10x10 ocean grids: (1) The computer’ the code for “ocean”. The 1-boat position will be an element with the integer 1 in it; the 2-boat position will be two adjacent elements with a 2 in t