BattleShip Arrays
Well
This is my code but when I run it the 2D array dont work and I just get lots of nubmers & letters
Any help?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
using namespace std;
int main(){
int Player2board;
int ship1;
int ship2;
int ship3;
cout << " ------------------------------- " << endl;
cout << " Welcome To ShipDestroyer V0.01 " << endl;
cout << " ------------------------------- " << endl;
cout << " -- PLAYER 1 SHIP BOARD -- " << endl;
cout << "---------------------------------" << endl;
cout << "Enter Position Of your First Ship ( 0 -- 9 )" << endl;
cin >> ship1;
cout << "Enter Position Of your Second Ship ( 0 -- 9 )" << endl;
cin >> ship2;
cout << "Enter Position Of your Third Ship ( 0 -- 9 )" << endl;
cin >> ship3;
cout << "---------------" << endl;
cout << "| GAME STARTS |" << endl;
cout << "---------------" << endl;
int ship11 = 5;
int ship22 = 2;
int ship33 = 1;
//map1[ship1-1] = ship1;
int map1[ 10 ][ 10 ] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } , { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
int map2[ 10 ][ 10 ] = {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }} ;
map1[ship1-1][ship2-1] = ship1,ship2;
for (int i=0; i<10; ++i){
for (int x=0; x<10; ++x){
cout << map1[i];
}
}
system("PAUSE");
}
Code:
0012FD7C

