c++ help needed

Discussion in 'The Lounge' started by hamid.mehmood, Jan 7, 2010.

  1. hamid.mehmood

    hamid.mehmood

    Joined:
    Jan 7, 2010
    Messages:
    1
    I am new at C++ and really don't know how to print two, two dimensional arrays side by side. Can someone help me out in this.
     
    hamid.mehmood, Jan 7, 2010
    #1
    1. Advertising

  2. hamid.mehmood

    alphah

    Joined:
    Jun 14, 2010
    Messages:
    37
    you need a for-loop like this

    for (int i = 1; i <10; ++i) {
    for (int j = 1; j < 10++j) {
    print(A[j];
    }
    }
     
    alphah, Jun 18, 2010
    #2
    1. Advertising

  3. hamid.mehmood

    alphah

    Joined:
    Jun 14, 2010
    Messages:
    37
    sorry a typo
    in c++ array counts from 0
    so you would do

    int i = 0; ...
    int j = 0...
     
    alphah, Jun 18, 2010
    #3
  4. hamid.mehmood

    alphah

    Joined:
    Jun 14, 2010
    Messages:
    37
    and to do the print, you will do

    cout

    you need to include #include<iostream>
     
    alphah, Jun 18, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dima
    Replies:
    5
    Views:
    1,368
    Dmitriy
    Oct 20, 2004
  2. Arawak
    Replies:
    2
    Views:
    7,218
    treehugger
    Nov 18, 2004
  3. sparticle
    Replies:
    3
    Views:
    1,230
  4. The Martian

    Help Help Help Please Pentax S5i info needed

    The Martian, May 19, 2008, in forum: Digital Photography
    Replies:
    2
    Views:
    512
    The Martian
    May 20, 2008
  5. The Martian

    Help Help Help Pentax S5i Help needed (Please)

    The Martian, Jun 4, 2008, in forum: Digital Photography
    Replies:
    14
    Views:
    1,670
    ASAAR
    Jun 20, 2008
Loading...

Share This Page