Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

creating an 2D array for my battleship game. Here what i have so far: #include using namespace std; const int ROWS = 10; const int

creating an 2D array for my battleship game. Here what i have so far:

#include

using namespace std;

const int ROWS = 10;

const int COLS = 10;

int main()

{

char board[ROWS][COLS];

for(int i = 0; i < ROWS; i++)

{

for(int j = 0; j < COLS; j++)

{

board[i][j] = '|';

}

}

for(int i = 0; i < ROWS; i++)

{

for(int j=0; j < COLS; j++)

cout << board[i][j] << " ";

cout << endl;

}

}

Here is the output that i need:

Enter firing coordinates !!! A 5

Hit !!!

Current Status

1 2 3 4 5 6 7 8 9 10

A | | | | | X | | | | | |

B | | | | | | | | | | |

C | | | | | | | | | | |

D | | | | | | | | | | |

E | | | | | | | | | | |

F | | | | | | | | | | |

G | | | | | | | | | | |

H | | | | | | | | | | |

I | | | | | | | | | | |

J | | | | | | | | | | |

Ammo remaining : 19

I need help creating rows A-J and Columns 1-10 so that when somone types in A 6, the X will go into the correct row/column

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions

Question

The amount of work I am asked to do is reasonable.

Answered: 1 week ago

Question

The company encourages a balance between work and personal life.

Answered: 1 week ago