Thread: One row per line?

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    10

    One row per line?

    Do you know what the output of this code would be? It should be outputting one row per line.


    Code:
    #include <iostream> 
    #include <iomanip>
    
    using namespace std;
    
    
    int main()
    {
        int matrix[4][3];
    
                                          
        
        int j, k;
    
        for (j = 0; j < 4; j++)
        {
            for (k = 0; k < 3; k++)
                matrix[j][k] = 2 * j + k;
                cout << matrix[j][k] << " ";
    
            cout << endl;
        }
    }

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Did you try reading a reply to your other thread?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. adding line numbers and concatenating a filename
    By durrty in forum C Programming
    Replies: 25
    Last Post: 06-28-2008, 03:36 AM
  2. Animation not working....
    By aquinn in forum C Programming
    Replies: 7
    Last Post: 02-19-2005, 05:37 AM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM