displaying a board with 2D array

This is a discussion on displaying a board with 2D array within the C++ Programming forums, part of the General Programming Boards category; hey guys, I'm trying to display a board with a multidimensional array...but it seems not to be working. The array ...

displaying a board with 2D array

hey guys, I'm trying to display a board with a multidimensional array...but it seems not to be working. The array is supposed to grab a certain random letter and the board should like the following, where the letters are from the array:

for( i='A'; i<='E'; i++)
//this means for i = 65 and as long as i <= 70, or something like
//that. I suspect you need something more like:
// for(i = 0; i < 5; ++i)
{
cout << i << " ";
for(j='A'; j<='E'; j++)
//same here, see above
{
randomLetteri = getCharacter(totalPercentArray);
//randomLetteri is never declared, but may well be typo
cout << boardArray[randomLetter][randomLetter] << endl;
//when the indexes of a 2D array are the same you will only
//see the values on a diagonal of the table (eg A1, B2, C3).
//Use i for first index and j for the second.
}
}

==============EDIT 2=================
I SOLVED THE PROBLEM THANKS TO HAMMER, THERFORE
THE FINAL EDIT. I CUT THE WHOLE CODE (AGAIN) ONLY
LEAVING THE FUNCTION THAT WAS IN QUESTION. THE SOLUTION
IS POSTED IN THE NEXT REPLY.
==============EDIT2=================

thanks a lot Hammer, I'll see what I can do with it. I read up on multidimensional arrays a bit today, so I'm getting a better handle on it.
The reason I had this:

Code:

theRandomNumber = (float)rand()/RAND_MAX;

is that I want the random number between 0-1. The reason for this is that earlier in my program I set a running percentage for some letters. So my function getChar() was to make a random number and the match it to the appropriate letter. I'm posting the whole thing, and if you have any more hints/suggestions I REALY do appreciate them: