Stack Fault in Turbo c++. Well this program should show the maximum value from each c

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • liviu152
    New Member
    • Jun 2014
    • 2

    Stack Fault in Turbo c++. Well this program should show the maximum value from each c

    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
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    The code does not crash on my Windows 7 laptop using Visual Studio 2013. I used 10 lines and 10 columns.

    Try stepping through the code using your debugger to pinpoint where the stack error occurs.

    I assume you are keeping below 100 lines and 100 columns.

    Comment

    • liviu152
      New Member
      • Jun 2014
      • 2

      #3
      allright...so the code does't crush on other program. pff...then i think that my Turbo C++ has a problem. Thanks for help :D

      Comment

      Working...