Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me with this problem. I\'m not getting it at all and it would be muc

ID: 3760224 • Letter: P

Question

Please help me with this problem. I'm not getting it at all and it would be much appreciated if you could post the coding for this program charA Programming Problems al array as the basis for creating the game battle are using a two-dimensional array as the basis for creating the t. Imagine we are using a two-di game of e of battleship a - character entry in the array represents ocean ship), a '#'character represents a place in the ocean where part of a ship is ndcharacter represents a place in the ocean where part of a ship is present ocean (i.e., ip is present, a ship is present and rs means the ship has been ship. In the nnd an H' character represents a place in the ocean where p and an n yit by a a ship, a '#, c s been hit by a to sunk and an If statement that prints "HIT" if a torpedo hits a shi heen bit by a torpedo. Thus, a ship with all 'H' characte k. Declar re a two-dimensional array that is 25 x 25 that represents the e ntire ocean and Y. Write a C++ program that will read in a file representing a game board wit above. An p given the coordinates X le representing a game board with 25 lines where each line has 25 characters corresponding to the description example file might look like: You should write a function called Fire that will take an X and Y coordinate and print HIT" if a ship is hit and "MISS" if a ship is missed. If a ship is HIT you should update the array with an 'H' character to indicate the ship was hit. If a ship is hit that has the array with an H' character to indicate the ship was hit. If a ship is hit that has already been hit at that location you should print "HIT AGAIN". You should write a second Your C++ which point th function called FleetSunk that will determine if all the ships have been sunk. program must then call these functions until all the ships have been sunk, at e program should display "The fleet was destroyed!"

Explanation / Answer

#include<iostream.h>
#include<conio.h>

void main()
{
   int x,y,i,j;

   char MineField[25][25];

   for(i=0;i<25;i++)
       for(j=0;j<25;j++)
           MineField[i][j]='~';

   srand(2185);

   for(i=0;i<25*25*0.1;i++)
   {
       x=rand()%25;
       y=rand()%25;

       MineField[x][y]='#';
   }

   for(i=0;i<25;i++)
   {
       for(j=0;j<25;j++)
       {
           cout<<MineField[i][j]);
       }
       cout<<" ";
   }
   getch();
}
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote