Thread: Ok Two Dimensional Arrays help!!!!!!!!!!!

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    Ok Two Dimensional Arrays help!!!!!!!!!!!

    //here's the code
    EDIT
    Code:
    #include <iostream>
    #include <stdlib.h>
    using namespace std;
    int main()
    {
    int SomeArray[5][2]= {{0,0},
                          {1,2},
                          {2,4},
                          {3,6},
                          {4,8}};
        for(int i=0; i<5; i++)
            for (int j=0; j<2; j++)
            {
              cout<<"SomeArray["<<i<<"]["<<j<<"]: ";
              cout<<SomeArray[i][j]<<endl;
              }
    
    
    
    
    
          system("PAUSE");
          return 0;
    }
    /*###################################*/

    OUTPUT:
    SomeArray[0][0]: 0// I don't get what is the computer refering to here, in terms of the code.
    SomeArray[0][1]: 0
    SomeArray[1][0]: 1
    SomeArray[1][1]: 2
    SomeArray[2][0]: 2// neither here
    SomeArray[2][1]: 4
    SomeArray[3][0]: 3
    SomeArray[3][1]: 6
    SomeArray[4][0]: 4
    SomeArray[4][1]: 8// basically all of these
    Press any key to continue . . .


    // Please help
    Last edited by incognito; 01-12-2002 at 09:04 PM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    162
    What exactly is your question? The program looks like it is running correctly. Is this your question?
    I don't get what is the computer refering to here, in terms of the code.
    It is referring to the first element of the first integer array. You can look at it as just five groups of arrays with two elements each. Each array is enclosed in brackets, and seperated by commas. If that doesn't help you then just reply back.

  3. #3
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Thanks I got it I just didn't understand the output but I got it. Thank you for your time.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointers and multi dimensional arrays
    By andrea72 in forum C++ Programming
    Replies: 5
    Last Post: 01-23-2007, 04:49 PM
  2. Dynamic two dimensional arrays
    By ThWolf in forum C++ Programming
    Replies: 14
    Last Post: 08-30-2006, 02:28 PM
  3. dimensional arrays
    By ZakkWylde969 in forum C++ Programming
    Replies: 3
    Last Post: 08-04-2003, 04:49 PM
  4. two dimensional arrays
    By ssjnamek in forum C++ Programming
    Replies: 4
    Last Post: 05-01-2002, 08:12 PM
  5. Two dimensional arrays
    By Jax in forum C Programming
    Replies: 1
    Last Post: 11-07-2001, 12:53 PM