Help: 2-dimensional array

• August 31st, 2013, 01:18 AM
imbapaps
Help: 2-dimensional array
1. Create one 2-dimensional array. The array will consist of numbers from 1 to 10. And will also contain the number in words. Display the values of the 2-dimensional array.
Sample output:
1 – One
2 – Two
3 – Three
Paste the program code here:

2. Create a program that will accept two integer numbers. These integer numbers will be the limit of the multiplication table. Store the values in a two dimensional array.
Sample output:
Enter x: 3
Enter y: 2
1 2 3
2 4 6
Paste the program code here:

3. Determine the output produced by the following program segment.
int ROWS = 3;
int COLS = 4;
int [ ] [ ] val = {{8,16,9, 52},{3,15,27,6},{14,25,2,10}};
for (int i=0; i < ROWS; i++)
{
for (int j= 0; j<COLS; j++)
System.out.print (val [i][j] + “ ” );
System.out.println ();
}

Write the Output:
• August 31st, 2013, 05:57 AM
2kaud
Re: Help: 2-dimensional array

http://forums.codeguru.com/showthrea...ork-assignment

and then post your specific programming question.
• August 31st, 2013, 06:45 AM
GCDEF
Re: Help: 2-dimensional array
• August 31st, 2013, 07:02 AM
2kaud
Re: Help: 2-dimensional array
Code:

```int ROWS = 3; int COLS = 4; int [ ] [ ] val = {{8,16,9, 52},{3,15,27,6},{14,25,2,10}}; for (int i=0; i < ROWS; i++) { for (int j= 0; j<COLS; j++) System.out.print (val [i][j] + “ ” ); System.out.println (); }```
This is NOT c++ code. This looks like c# code. This is a c++ forum!

Moderator - please would you move this thread to the correct forum.
• August 31st, 2013, 09:20 AM
Peter_B
Re: Help: 2-dimensional array
Quote:

Originally Posted by imbapaps
3. Determine the output produced by the following program segment.
int ROWS = 3;
int COLS = 4;
int [ ] [ ] val = {{8,16,9, 52},{3,15,27,6},{14,25,2,10}};
for (int i=0; i < ROWS; i++)
{
for (int j= 0; j<COLS; j++)
System.out.print (val [i][j] + “ ” );
System.out.println ();
}

Write the Output:

You can't even be bothered to wrap this up into a complete program and run it to get the answer, yet you expect us to write two programs for you? :mad:
• August 31st, 2013, 10:55 AM
Eri523
Re: Help: 2-dimensional array
Quote:

Originally Posted by 2kaud
Code:

```int ROWS = 3; int COLS = 4; int [ ] [ ] val = {{8,16,9, 52},{3,15,27,6},{14,25,2,10}}; for (int i=0; i < ROWS; i++) { for (int j= 0; j<COLS; j++) System.out.print (val [i][j] + “ ” ); System.out.println (); }```
This is NOT c++ code. This looks like c# code. This is a c++ forum!

Moderator - please would you move this thread to the correct forum.

I'd rather say it's Java.
• August 31st, 2013, 03:00 PM
2kaud
Re: Help: 2-dimensional array
Quote:

I'd rather say it's Java.
Java? Java???? Oh yes, that which our security auditors keep telling us to disable. I never touch it! :D