Random Coordnate generator

In my Highschool Programming club we are trying to make a guessing game that works similar to Battleship, guess the cordinates that the Computer randomly generators I think I have found an example that I could use in order to do this but it conufuses me at this point,
1
2
3
4
char State[50][255] = {"Alabama",
					   "Alaska",
					   "Arizona",
					   "Arkansas",
Etc.
Im assuming the 50 after char State means the fifty states that it will pick from, whats the 255 mean?
That is the length of the 2nd dimension in the char table you have declared, i.e. the maximum length of any state's name.
Thanks, thats one thing I thought but wasnt sure.
Why not use a C++ data structure instead of a 2D character array?

A fixed length vector of strings, or an array of strings would be a better idea.

e.g
1
2
3
4
5
6
string State[50] = {"Ala", "Bala" etc};

vector<string> States;
States.resize(50);

States[0] = "Alabama";
Topic archived. No new replies allowed.