procedure SumAColumn(ColumnNumber,StartRow,EndRow,DestRow : int,
var DataArray : array 1 .. * , 1 .. * of real)
%
% Your code here
%
end SumAColumn
procedure Compute(Col1,Col2,Col3,ColR : int,
StartRow,EndRow : int,
var DataArray : array 1 .. * , 1 .. * of real)
%
% Your code here
%
end Compute
procedure GetArray(Nrows,Ncols : int, var DataArray : array 1 .. * , 1 .. * of real)
put "Input the elements by rows "
for row : 1 .. Nrows
put "Row ",row,": "
for col : 1 .. Ncols
get DataArray(row,col)
end for
end for
end GetArray
procedure PrintArray(Nrows,Ncols : int, DataArray : array 1 .. * , 1 .. * of real)
for row : 1 .. Nrows
for col : 1 .. Ncols
put DataArray(row,col):8:3, " "..
end for
put ""
end for
end PrintArray
var Nrows, Ncols : int
put "Number of rows? "
get Nrows
put "Number of columns? "
get Ncols
var Sheet : array 1 .. Nrows, 1 .. Ncols of real
put ""
GetArray(Nrows,Ncols,Sheet)
PrintArray(Nrows,Ncols,Sheet)
put ""
SumAColumn(2,1,3,4,Sheet)
PrintArray(Nrows,Ncols,Sheet)
put ""
SumAColumn(3,2,4,1,Sheet)
PrintArray(Nrows,Ncols,Sheet)
put ""
Compute(1,2,3,5,1,3,Sheet)
PrintArray(Nrows,Ncols,Sheet)