And this is my program.
#include<iostre am.h>
void main ()
{
int a[100][100], i,j,m,n;
cout<<"number of lines : ";
cin>>n;
cout<<"number of columns : ";
cin>>m;
for(i=0;i<n;i++ )
for(j=0;j<m;j++ )
{
cout<<"a["<<i<<"]["<<j<<"]=";
cin>>a[i][j];
}
for(j=0;j<m;j++ )
{
int max=0;
for(i=0;i<n;i++ )
{
if(a[i][j]>max)
max=a[i][j];
}
cout<<max<< " ";
}
}
Well this program should show the maximum value from each column. Unfortunately , when i run it in Turbo C++ , apears a Stack Fault at 0002:000E. Please show me how can i resolve this problem
#include<iostre am.h>
void main ()
{
int a[100][100], i,j,m,n;
cout<<"number of lines : ";
cin>>n;
cout<<"number of columns : ";
cin>>m;
for(i=0;i<n;i++ )
for(j=0;j<m;j++ )
{
cout<<"a["<<i<<"]["<<j<<"]=";
cin>>a[i][j];
}
for(j=0;j<m;j++ )
{
int max=0;
for(i=0;i<n;i++ )
{
if(a[i][j]>max)
max=a[i][j];
}
cout<<max<< " ";
}
}
Well this program should show the maximum value from each column. Unfortunately , when i run it in Turbo C++ , apears a Stack Fault at 0002:000E. Please show me how can i resolve this problem
Comment