7 Replies - 2476 Views - Last Post: 17 April 2003 - 12:03 PM Rate Topic: -----

#1 fijufiic  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 11-July 02

Rectangular Arrays

Post icon  Posted 12 April 2003 - 11:31 AM

Hello everyone!

I just recently started learning Java and got stuck with the rectangular arrays.
I was wondering if there is anyone that could briefly tell me the easiest way to display such array. A simple example would be greatly appreciated!

Thanks!

-f-
Is This A Good Question/Topic? 0
  • +

Replies To: Rectangular Arrays

#2 Koenie  Icon User is offline

  • What?!

Reputation: 0
  • View blog
  • Posts: 1,313
  • Joined: 08-July 02

Re: Rectangular Arrays

Posted 13 April 2003 - 02:17 AM

Can you please explain what you mean with 'rectangular'???
I suppose you mean 2-dimensional arrays...
Was This Post Helpful? 0
  • +
  • -

#3 cyberscribe  Icon User is offline

  • humble.genius
  • member icon

Reputation: 10
  • View blog
  • Posts: 1,062
  • Joined: 05-May 02

Re: Rectangular Arrays

Posted 14 April 2003 - 07:24 PM

fijufiic, on Apr 12 2003, 10:31 AM, said:

the easiest way to display such array

It depends on what is in the array...
Was This Post Helpful? 0
  • +
  • -

#4 arniie  Icon User is offline

  • D.I.C Addict

Reputation: 0
  • View blog
  • Posts: 999
  • Joined: 08-October 02

Re: Rectangular Arrays

Posted 15 April 2003 - 01:44 AM

<digress> is anything happening with your web site cyberscribe ??? </digress>

This post has been edited by arniie: 15 April 2003 - 01:44 AM

Was This Post Helpful? 0
  • +
  • -

#5 cyberscribe  Icon User is offline

  • humble.genius
  • member icon

Reputation: 10
  • View blog
  • Posts: 1,062
  • Joined: 05-May 02

Re: Rectangular Arrays

Posted 15 April 2003 - 10:54 AM

arniie, on Apr 15 2003, 12:44 AM, said:

<digress> is anything happening with your web site cyberscribe ??? </digress>

It's ... um... gestating at the moment:

http://www.peakepro.com

:)
Was This Post Helpful? 0
  • +
  • -

#6 fijufiic  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 11-July 02

Re: Rectangular Arrays

Posted 16 April 2003 - 08:20 AM

Ok, yes, it is 2-dimensional array... I have to prompt user for width, total numbers to be displayed and the value of the first number of the array to be displayed.

So, if I enter:
width: 5
count: 12
start: 22

the output should look like:
22 23 24 25 26
27 28 29 30 31 ---> This display is what I have problem with!
32 33

Thanks!

-f-
Was This Post Helpful? 0
  • +
  • -

#7 Noffke  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 497
  • Joined: 09-August 02

Re: Rectangular Arrays

Posted 16 April 2003 - 10:00 AM

so if you have the array filled then just set up some for loops and run through it

for (i = 0; i < the # of rows; i++){
    for(j = 0; j < the # of columns; j++) {
             System.out.print(yourArray[i][j] + " ")
    }
     enter a newline here
}

I didnt account for the missing elements on the end of the array, but you could put some sort of if statement in there to see if there is a value
Was This Post Helpful? 0
  • +
  • -

#8 fijufiic  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 11-July 02

Re: Rectangular Arrays

Posted 17 April 2003 - 12:03 PM

I finally got it to work!
Thanks!

-f-
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1