cout << " "; // Move over a space before printing the 'A'
for( char a='A';a<'H';a++)
cout << a << " ";
cout << endl; // New line before the start of the vertical numbers
for ( int i = 1; i < 8;i++)
cout << i << endl;
And next how is it possible to do something like marking a missed spot.. or hit spot..
I would set up an array, like this, if the board is 10x10.
1 2 3 4 5 6 7 8 9
int ships[10][10] = {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}};
ships[2][3]=1; // 1 for aircraft carriers
ships[2][4]=1;
ships[2][5]=1;
ships[2][6]=1;
ships[6][2]=2; // 2 for battleship
ships[7][2]=2;
ships[8][2]=2;
etc..
Then check the users input for row/column. If something is there, show a hit. You really shouldn't say what the type is, otherwise they know how many spaces it takes.. Tell them what was sunk, only after the last hit on that ship.
int shots[10][10] = {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}; Check the location in this array for their shot. Place a 1 at the location of their shot if it is a 0, otherwise tell them they already there. Either let them shoot again, or penalize them a shot, and then shoot again.
I Hope this was useful ...
Thanks! I've saved these notes into my template for reference. I'm currently doing the identifying of ship type..
Will u be able to help me out on this?