|
|
- #include<iostream>
- using namespace std ;
- int Total=5,TempInt=0 ;
- void Sum(int MatrixSum[])
- {
- for(int i=0;i<=Total;i++)
- {
- TempInt=TempInt+MatrixSum[i] ;
- }
- }
- int main()
- {
- int *Matrix = new int[Total] ;
-
- for(int i = 0;i<=Total;i++)
- {
- cout << "Matrix[" << (i+1) << "] = " ;
- cin >> Matrix[i] ;
- }
-
- Sum(Matrix) ;
- cout << endl << "Sum = " << TempInt ;
-
- delete Matrix ;
- cout << endl ;
-
- system("PAUSE") ;
- return 0 ;
- }
複製代碼 |
|