When i run this program it takes more values and prints less values....
this runs on Dev C++(www.bloodshed.net)

#include<iostream>
using namespace std;
#include<conio.h>
int main()
{
    int arr[5][5],i,j,k,l;
    cout<<"Enter matrix row wise";
    for(i=0;i<=3;i++)
    {
         for(j=0;j<3;j++)
         { 
             cin>>arr[i][j];                
         }
    
     }

      for(k=0;k<3;k++)
      {   
          for(l=0;l<3;l++)
          {   
              cout<<" "<<arr[k][l];
          } 
          printf("\n");
          
      }
getch();
}

Edited 5 Years Ago by suraj_p: to add a missing statement

So what are ye' trying to do with this code? (why doesn't it work the way you think it should)

Edited 5 Years Ago by Clinton Portis: n/a

Actually i am a newbie to c++
i have been trying to initialise a matrix using 2D array.
when i input members row wise then it takes 3 numbers more and displays all numbers excluding last three...
i want to input a matrix and output the same matrix in Matrix form

for(i=0;[B]i<=3[/B];i++)
{
  for(j=0;[B]j<3[/B];j++)
  {
   //input
  }
 
}
 
for(k=0;[B]k<3[/B];k++)
{
  for(l=0;[B]l<3[/B];l++)
     //output

Look at the difference between the loop test in your input and output sections? Shouldn't they be the same? Or at least use the same relational op?

This question has already been answered. Start a new discussion instead.