Ok guys so i have a project to do for my c++ class and its supposed to be about two ships (one the player, the other one the computer) and they are on a 10x10 plane created by an array. I did the plane, now how do i get the ships on to their starting positions on the plane? I am really frustrated with this, please help!
This is what i have:

#include <cstdlib>
#include <iostream>
#include <iomanip>

using namespace std;

const int ROW = 10;
const int COL = 10;

void printBoard (int[][COL]);

int main(int argc, char *argv[])
    int gameboard[ROW][COL];
    return EXIT_SUCCESS;

void printBoard (int [] [COL])
    for (int rows = 0; rows < ROW; rows++)
        for (int collumns = 0; collumns < COL; collumns++)
            cout << " *";
        cout << endl; 

I know im supposed to represent them as different characters so "P" would be for the players ship, and "C" is for the computers ship.

Ask the user for a starting coordinate (row, column), orientation (horizontal or vertical), and size of ship. Make sure the ship will fit in the area (i.e., isn't too long in one dimension or isn't already taken up by another ship). Change the value of the board at the appropriate coordinates to "P" or "C"

Try that and see what you come up with. If you're having another difficulty with it, post back.

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