Перевести из языка Си++ в Паскаль
#include
#include
#include
#include
#include
using namespace std;
int main(){
srand(time(NULL));
int n;
cin»n;
int mass[n][n];
int mass1[n][n];
for(int i=0; i for(int j=0; j mass[i][j]=rand()%10*pow(-1,rand()%2);
cout«setw(4)«mass[i][j]«' ';
}
cout«endl;
}
cout«endl;
for(int i=0;i for(int j=0; j mass1[j][n-1-i]=mass[i][j];
}
}
for(int i=0; i for(int j=0; j cout«setw(4)«mass1[i][j];
if(mass1[i][j]>0){
mass1[i][j]=1;
}
}
cout«endl;
}
cout«endl;
for(int i=0; i for(int j=0; j cout«setw(4)«mass1[i][j];
}
cout«endl;
}
return 0;
}
Answers & Comments
// PascalABC.NET 3.6
begin
var n:= ReadInteger;
var a := MatrRandom(n, n, -99, 99);
var b := new integer[n,n];
a.Println;
Writeln;
for var i := 0 to n-1 do
b.SetCol(n - i - 1, a.Row(i));
b.Transform(t -> t > 0 ? 1 : t);
a := b;
a.Println
end.