Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
58
Task/Identity-matrix/Action-/identity-matrix.action
Normal file
58
Task/Identity-matrix/Action-/identity-matrix.action
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
PROC CreateIdentityMatrix(BYTE ARRAY mat,BYTE size)
|
||||
CARD pos
|
||||
BYTE i,j
|
||||
|
||||
pos=0
|
||||
FOR i=1 TO size
|
||||
DO
|
||||
FOR j=1 TO size
|
||||
DO
|
||||
IF i=j THEN
|
||||
mat(pos)=1
|
||||
ELSE
|
||||
mat(pos)=0
|
||||
FI
|
||||
pos==+1
|
||||
OD
|
||||
OD
|
||||
RETURN
|
||||
|
||||
PROC PrintMatrix(BYTE ARRAY mat,BYTE size)
|
||||
CARD pos
|
||||
BYTE i,j,v
|
||||
|
||||
pos=0
|
||||
FOR i=1 TO size
|
||||
DO
|
||||
FOR j=1 TO size
|
||||
DO
|
||||
v=mat(pos)
|
||||
IF j=size THEN
|
||||
PrintF("%I%E",v)
|
||||
ELSE
|
||||
PrintF("%I ",v)
|
||||
FI
|
||||
pos==+1
|
||||
OD
|
||||
OD
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
BYTE size
|
||||
BYTE ARRAY mat(400)
|
||||
BYTE LMARGIN=$52,old
|
||||
|
||||
old=LMARGIN
|
||||
LMARGIN=0 ;remove left margin on the screen
|
||||
|
||||
DO
|
||||
Print("Get size of matrix [1-20] ")
|
||||
size=InputB()
|
||||
UNTIL size>=1 AND size<=20
|
||||
OD
|
||||
|
||||
CreateIdentityMatrix(mat,size)
|
||||
PrintMatrix(mat,size)
|
||||
|
||||
LMARGIN=old ;restore left margin on the screen
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue