Were it me, I'd simply hold a 2D array of 0s, and then put a row of 5 1s to represent a battleship, 2 2s to represent a patrol boat, etc.

Testing a location simply looks up the index there, and increments the hit count on the hit vessel (if any). Once a vessel takes enough hits it is destroyed.

Of course, you'd need to reject previously guessed positions first for this to work. Maybe use the sign bit to do that (since it doesn't matter if a 0 position is guessed twice).