Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Print an arrays by coulms

Print an arrays by coulms

Scheduled Pinned Locked Moved C#
data-structures
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    newbie_
    wrote on last edited by
    #1

    I need to write an arrays by coulms i have the following array

    a1={1,2,3,4,5,6}
    a2={7,8,9,10,11}
    .
    .
    .
    .
    an={10,11,12,13,14,15}

    and i want to print it as

    1 7 ... 10
    2 8 ... 11
    3 9 ... 12
    4 10 ... 13
    5 11 ... 14
    6 12 ... 15

    CPalliniC S 2 Replies Last reply
    0
    • N newbie_

      I need to write an arrays by coulms i have the following array

      a1={1,2,3,4,5,6}
      a2={7,8,9,10,11}
      .
      .
      .
      .
      an={10,11,12,13,14,15}

      and i want to print it as

      1 7 ... 10
      2 8 ... 11
      3 9 ... 12
      4 10 ... 13
      5 11 ... 14
      6 12 ... 15

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Aren't you really really able to figure out how to accomplish such task (you know array elements may be accessed by indexes...)? :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • N newbie_

        I need to write an arrays by coulms i have the following array

        a1={1,2,3,4,5,6}
        a2={7,8,9,10,11}
        .
        .
        .
        .
        an={10,11,12,13,14,15}

        and i want to print it as

        1 7 ... 10
        2 8 ... 11
        3 9 ... 12
        4 10 ... 13
        5 11 ... 14
        6 12 ... 15

        S Offline
        S Offline
        SeMartens
        wrote on last edited by
        #3

        Hi, what about this code? I'm supposing that you have all arrays in a list called aListOfArrays.

        int iColumnCount = aListOfArrays[0].length;

        for(int iCurColumn = 0; iCurColumn < iColumnCount; iCurColumn++) {
        for(int iCurArray = 0; iCurArray < aListOfArrays.Count; iCurArray++) {
        System.out.print(" " + aListOfArrays[iCurArray][iCurColumn].ToString());
        }
        System.out.println();
        }

        Does this help you? Regards Sebastian

        It's not a bug, it's a feature! Me in Softwareland.

        J N 2 Replies Last reply
        0
        • S SeMartens

          Hi, what about this code? I'm supposing that you have all arrays in a list called aListOfArrays.

          int iColumnCount = aListOfArrays[0].length;

          for(int iCurColumn = 0; iCurColumn < iColumnCount; iCurColumn++) {
          for(int iCurArray = 0; iCurArray < aListOfArrays.Count; iCurArray++) {
          System.out.print(" " + aListOfArrays[iCurArray][iCurColumn].ToString());
          }
          System.out.println();
          }

          Does this help you? Regards Sebastian

          It's not a bug, it's a feature! Me in Softwareland.

          J Offline
          J Offline
          J a a n s
          wrote on last edited by
          #4

          You helped him in doing his homework. :) Now I am expecting another question for converting java into c# :-D

          *jaans

          S 1 Reply Last reply
          0
          • S SeMartens

            Hi, what about this code? I'm supposing that you have all arrays in a list called aListOfArrays.

            int iColumnCount = aListOfArrays[0].length;

            for(int iCurColumn = 0; iCurColumn < iColumnCount; iCurColumn++) {
            for(int iCurArray = 0; iCurArray < aListOfArrays.Count; iCurArray++) {
            System.out.print(" " + aListOfArrays[iCurArray][iCurColumn].ToString());
            }
            System.out.println();
            }

            Does this help you? Regards Sebastian

            It's not a bug, it's a feature! Me in Softwareland.

            N Offline
            N Offline
            newbie_
            wrote on last edited by
            #5

            thank you Sebastian it worked with me so good i appreciate you help. the rest of you guys , i am sorry that i am not genius as you, but i don't think there is problem to get some help with other and i guess that's the whole point of this form i know i am not professional and i didn't say that i am but i am doing my best in learning

            modified on Friday, January 16, 2009 6:18 AM

            1 Reply Last reply
            0
            • J J a a n s

              You helped him in doing his homework. :) Now I am expecting another question for converting java into c# :-D

              *jaans

              S Offline
              S Offline
              SeMartens
              wrote on last edited by
              #6

              Shame on me :^) I'm expecting a question like: "Now I have to add all numbers together..."

              It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups