i am trying to write a program to play the Battleship game;It is not a homework problem just a practice problem.
The instructions are: set up a coordinate grid, select your own ships and locations while the computer selects its own; launch missiles by entering coordinates and accept hits from the computer.
Thanks :)

i am trying to write a program to play the Battleship game;It is not a homework problem just a practice problem.

Good program to practice on. Well done.

The instructions are: set up a coordinate grid, select your own ships and locations while the computer selects its own; launch missiles by entering coordinates and accept hits from the computer.

Yes, that's how BShip works -- for the most part.

Thanks :)

You're welcome.

Comments
:)

How to i get started. Like how to i need to go about creating the program.

break everything up into small parts and then put them together.

You need a game board right?
1. set up an array that will represent the coordinate system
2. Get the basic board to print to the screen (loop through array and print elements)

you need boats?
1. make a boat struct that has the ships condition and coordinates
2 make an array of them
3. place on the board by giving numbers to each boat ( 1 to n) however many you want and fits on board
4. so numbers higher than zero represent a boat
0 0 0 0 0
0 0 1 1 1
0 2 0 0 3
0 2 0 0 3
0 2 0 0 3


make a shot system
1. if the user gets a hit add 100 to the position so you know its a hit
2. if its a miss make the element a negative one
3. you have to handle duplicates as well

hopefully this can get you in the mindset and you can start somewhere
if you know some c++ you could make the game board a class

This article has been dead for over six months. Start a new discussion instead.