I am assigned to develop a multiplication table using 2D Arrays and Nested loops. The teacher gave us a starting form/etc, but I just dont know where to start! 2 dimensional arrays really threw me for a loop (no pun intended). Can anyone help get me started?
I have attached the startup form, etc. Here are the class requirements:
- A two dimensional array has been declared in the program as: int [ , ] intTable = new int[9,9]; // 9 x 9 table
- Students are to develop the method that loads the multiplication table into the array using nested loops. Use intTable.GetLength(0) to go down the table and intTable.GetLength(1) to go across.
- Students are to develop the method that displays the array after it has been loaded with the multiplication table using nested loops.
- Students are to develop the method that searches the array for all occurrences of the number entered as the search criteria in the textbox. Again, use nested loops.
How shall I start this one?

VulpesRank #55 · 29.2K reputationPosted Apr 19, 2012, 1:05 AM EDT
Ryan Krenz7 reputationPosted Apr 21, 2012, 9:08 AM EDT
Also, I could use a hint on the "search" function.
Here is my code for the "display", what am I missing?
I also attached my updated project.
THank you!
Ryan Krenz7 reputationPosted Apr 21, 2012, 9:11 AM EDT
private void btnDisplayArray_Click(object sender, EventArgs e)
{
int r; //row
int c; //column
string strSpace;
txtTable.Clear(); //clear the text box
r = 0;
while (r < 8)
{
r++;
c = 0;
while (c < 8)
{
c++;
if (intTable[r, c] < 10)
strSpace = " "; //two spaces
else
strSpace = " "; //one space
txtTable.AppendText(strSpace); // insert space
txtTable.AppendText(intTable[r, c].ToString()); //insert result
}
txtTable.AppendText("\r\n"); //Move down one line
}
}
VulpesRank #55 · 29.2K reputationPosted Apr 21, 2012, 10:17 AM EDT
Ryan Krenz7 reputationPosted Apr 21, 2012, 11:26 AM EDT
edmund durango3 reputationPosted Jul 20, 2012, 10:12 PM EDT
i will try this in my school....