include iostream include Math include cstdlib const int one const int

 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
#include <iostream>
#include <Math.h>
#include <cstdlib>
const int one = 3;
const int two = 3;
int sum(int arr[::one][::two]);
int main() {
int arr[::one][::two];
for(int i = 0; i < ::one; i++)
for(int i1 = 0; i1 < ::two; i1++) {
std::cout << "arr[" << i << "][" << i1 << "] = ";
std::cin >> arr[i][i1];
}
std::cout << "sum = " << sum(arr) << std::endl;
system("PAUSE");
return 0;
}
int sum(int arr[::one][::two]) {
int sum = 0;
for(int i = 0; i < ::one; i++)
for(int i1 = 0; i1 < ::two; i1++)
if(fabs(arr[i][i1]) != arr[i][i1])
sum += arr[i][i1];
return sum;
}