One row per line?

This is a discussion on One row per line? within the C++ Programming forums, part of the General Programming Boards category; Do you know what the output of this code would be? It should be outputting one row per line. Code: ...

  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,006
    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, 04:37 AM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21