Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Identity-matrix/XPL0/identity-matrix.xpl0
Normal file
17
Task/Identity-matrix/XPL0/identity-matrix.xpl0
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
include c:\cxpl\codes;
|
||||
def IntSize = 4; \number of bytes in an integer
|
||||
int Matrix, Size, I, J;
|
||||
|
||||
[Text(0, "Size: "); Size:= IntIn(0);
|
||||
Matrix:= Reserve(Size*IntSize); \reserve memory for 2D integer array
|
||||
for I:= 0 to Size-1 do
|
||||
Matrix(I):= Reserve(Size*IntSize);
|
||||
for J:= 0 to Size-1 do \make array an identity matrix
|
||||
for I:= 0 to Size-1 do
|
||||
Matrix(I,J):= if I=J then 1 else 0;
|
||||
for J:= 0 to Size-1 do \display the result
|
||||
[for I:= 0 to Size-1 do
|
||||
[IntOut(0, Matrix(I,J)); ChOut(0, ^ )];
|
||||
CrLf(0);
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue