Help with battleship program?

closed account (EApGNwbp)
aa
Last edited on
I wrote a similar exercise a few weeks ago, which asks to generate random the coordinate of the shoot and then to give the computer the "intelligence" to find the ship and sink it. I didn't understand your message, you wrote that if the user put in for three times coordinates where there are no ships the program finishes, isn't it? I can't understand very well the problem you gave us
How to generate a random number -> http://www.cplusplus.com/forum/beginner/27995/


You can declare an array filled with the char O a few ways.

An easy way is to use std:fill

char board[10]; // declare array

std::fill(board, board+10, 'O'); // fills the board with the char O
Topic archived. No new replies allowed.