Перевести код на С++
const n=3; m=4;
var
a:array[1..n,1..m] of integer;
b:array[1..n*m] of integer;
i,j,k:integer; sr:real;
begin
Randomize;
writeln('Исходный массив:');
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(100);
write(a[i,j]:4);
end;
writeln;
end;
sr:=0;
for i:=1 to n do
for j:=1 to m do sr:=sr+a[i,j];
sr:=sr/(n*m);
writeln('sr = ',sr);
k:=0;
for i:=1 to n do
for j:=1 to m do
if a[i,j] writeln('Полученный массив:');
for i:=1 to k do write(b[i]:4);
writeln;
end.