Alright, so I need to pass this class and I have no idea how to do this program... It's been either hit or miss for me in this class and I likely need to do well on this assignment in order to pass class... we need to create a battleship program with the following parameters:
You must use a two dimensional array (10 rows and 10 columns)
You need to use at least 1 function
You need to use at least one procedure
You must not allow the user to enter a row or column number outside of the 1-10 range
If a user attempts to place a shot into a location they have already shot at (whether it was a miss
or a hit) allow them to re-enter the shot as many times as needed until they get it right.
Ships cannot overlap (occupy any of the same spaces) for an individual player
Ships can be arranged horizontally or vertically but not diagonally
Ships cannot extend outside of the grid, take care to check bounds
Be sure you track shots (misses and hits an present the results to the players)
You must be able to detect a winner if all ships have been sunk for a player.
Place all 5 ships for each player
Computer player places ships and takes shots.
Notify the player(s) which ship was sunk when it gets sunk.
Any information would be greatly appreciated... I'll basically have a week and a half to do this after spring break so wish me luck! Thanks again for any help I receive!
Well, that two-dimensional array can be done numerically. You can zero each value in the array, then when the player places ships, have them set to 2. Every shot would be registered as a 1- if the value is a 2 where it shoots, register it as a 3. If it's already a 1 or 3, ask to fire again.