Revisit of battleship in C++