Battleship.h contains global constant variables. Exercise11_v19.cpp is the source file containing my half of the program logic. libBattleShip.a and libbssupl.a are necessary library files which run my functions. game.txt is a sample result of 500 games. To see the results, you must redirect the program output to a file. The libraries only work on Windows, so you must compile and run the program on Windows. The program first asks how many games to play. Selecting any number greater than 1 will automatically play the games and then exit.
To compile, load .cpp and libraries into IDE of your choice, and compile and run. If you're not sure how, you can download code blocks IDE: http://www.codeblocks.org/. Then open the .cpp file in code blocks. To attach the libraries, go to settings > compilter > linker settings tab and then add the two .a files here. In order for the program to compile correctly, the libBattleShip.a must appear before libbssupl.a in the Link libraries list.
Note: This program was written a year ago when I first learned structured programming in C++. Since then I've learned about object oriented programming, which can actually be utilized in this file to reduce the amount of repeated code. A class can be made to represent a ship and can include the placement algorithm and data members representing the ship size. Then the program would simply need to instantiate 5 ships with appropriate sizes and call their placement functions.