I'm trying to place battleships in my battleship board which I've already created using a sub routine. I'm trying to create another sub routine to do this... so far this is what I have.
When I enter in the coordinates it just keeps giving me back the same ship, It wont let me move onto the next one... What am I doing wrong?
do{
printf("Shots fired! Commander, it's time for battle!\n");
printf("Enter the coordinates of your carrier #,# and its orientation (H or V).\nMake sure these coordinates are between 1-10\n");
printf("ex. 2 3 H\n");
scanf("%d %d %c",&i,&j,&o);
}
while ( i < 10 && j < 10 && i > 0 && j > 0 && (o != 'H' || o != 'V'));
printf("Enter the coordinates of your battleship in the same format\n");
scanf("%d %d %d",&i,&j,&o);
while( i < 10 && j < 10 && i > 0 && j > 0 && (o != 'H' || o != 'V'));
printf("Enter the coordinates of your destroyer in the same format\n");
scanf("%d,%d %d",&i,&j,&o);
while( i < 10 && j < 10 && i > 0 && j > 0 && (o != 'H' || o != 'V'));
printf("Enter the coordinates of your submarine in the same format\n");
scanf("Deploy ship here %d,%d %d",&i,&j,&o);
while( i < 10 && j < 10 && i > 0 && j > 0 && (o != 'H' || o != 'V'));
printf("Enter the coordinates of your submarine in the same format\n");
scanf("Deploy ship here %d,%d %d",&i,&j,&o);
while( i < 10 && j < 10 && i > 0 && j > 0 && (o != 'H' || o != 'V'));
}
/*----------------------------------------------------------------------------
------------------------------------------------------------------------------*/
void print_board(board)
char board [10][10];
{
int i,j;
int a=1;
int c=1;
for (a=0;a<11;a++){
printf( "%4d",a);}
printf("\n");
printf(" +---+---+---+---+---+---+---+---+---+---+\n\n");
for (i=0;i<10;i++){
for(j=0;j<10;j++){
board[i][j]= '|';}}