Перевести с pascal на c++ (код не мой):
uses crt;
const mmax=23;
nmax=18;
var a: array[1..mmax+1,1..nmax+1] of integer;
m,n,i,j,imn,imx: byte;
sm,sp: integer;
begin
clrscr;
randomize;
repeat
write('количество строк до ',mmax,' m=');
readln(m);
until m in [1..mmax];
repeat
write('количество столбцов до ',nmax,' n=');
readln(n);
until n in [1..nmax];
clrscr;
writeln('исходная матрица c суммами по строкам и столбцам: ');
for i: =1 to m do
for j: =1 to n do
a[i,j]: =random(50);
sp: =0;
for i: =1 to m do
begin
sm: =0;
for j: =1 to n do
sm: =sm+a[i,j];
a[i,n+1]: =sm;
sp: =sp+sm;
end;
for j: =1 to n do
begin
sm: =0;
for i: =1 to m do
sm: =sm+a[i,j];
a[m+1,j]: =sm;
end;
a[m+1,n+1]: =sp;
for i: =1 to m+1 do
begin
for j: =1 to n+1 do
if j=n+1 then write(a[i,j]: 7)
else write(a[i,j]: 4);
if i< =m then writeln;
end;
readln
end