func - 2 dim - sum outer cells

what is the wrong ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <cstdlib>
#include <iostream>
int sum (int a[][100],int s);
using namespace std;
int main()
{

    int N;
    int n=N-1;
    int s=0;
    
    cout<< " Please insert size of your sequare matrix= ";
    cin>>N;
    
    int a[N][100];
    cout<< " Please insert values of your sequare matrix= ";
    for (int i=0; i<N; i++)
        for (int j=0; j<N; j++)
        cin>>a[i][j];
        
    for (int i=0; i<N; i++)
        { for (int j=0; j<N; j++)
        cout<<a[i][j]<<" ";
        cout<<endl;
        }
        
    cout<<"sum of outer cells="<< sum (a, s);
    
    int sum (int a[][100],int s);  
       
     for (int i=0; i<N; i++);
        for (int j=0; j<N; j++);
        {
            int i;
            int j;
            if(i==0||i==n);
            s=s+a[i][j];
             
            if(j==0||j==n);
            s=s+a[i][j];  
             
             return s;
        }
     
     
    system("PAUSE");
    return EXIT_SUCCESS;
}
.
First of all you should re-study how to write and call a function... You put your "sum" function definition inside the main and with no curly brackets: there is no way this code can work!
Topic archived. No new replies allowed.