sorry wrong code

This is a discussion on sorry wrong code within the C++ Programming forums, part of the General Programming Boards category; This code is supposed to output one row per line but it is not. Does anyone know how to fix ...

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

    sorry wrong code

    This code is supposed to output one row per line but it is not. Does anyone know how to fix it?

    Code:
    #include <iostream> 
    #include <iomanip>
    
    using namespace std;
    
    
    int main()
    {
        int beta[10][5];
    
                                          
        
        int j, k;
    
        for (k = 0; k < 5; k++)
        {
            for (j = 0; j < 10; j++)
              {
                
                cout << beta[j][k] << " ";
              }
            cout << endl;
        }
    }

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,442
    Does anyone know how to fix it?
    Yes. Start tracing your program to find out. If beta was actually initialised/assigned to, you may find that it is actually displaying one column per line.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is wrong in this simple code
    By vikingcarioca in forum C Programming
    Replies: 4
    Last Post: 04-23-2009, 07:10 AM
  2. what is wrong with this code please
    By korbitz in forum Windows Programming
    Replies: 3
    Last Post: 03-05-2004, 09:11 AM
  3. I cant find what is wrong with this code
    By senegene in forum C Programming
    Replies: 1
    Last Post: 11-12-2002, 05:32 PM
  4. Anyone see what is wrong with this code?
    By Wise1 in forum C Programming
    Replies: 2
    Last Post: 02-13-2002, 01:01 PM
  5. very simple code, please check to see whats wrong
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 10-10-2001, 12:51 AM

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