Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,67 @@
|
|||
DEFINE PTR="CARD"
|
||||
|
||||
TYPE Matrix=[
|
||||
BYTE width,height
|
||||
PTR data] ;BYTE ARRAY
|
||||
|
||||
PROC PrintB2(BYTE b)
|
||||
IF b<10 THEN Put(32) FI
|
||||
PrintB(b)
|
||||
RETURN
|
||||
|
||||
PROC PrintMatrix(Matrix POINTER m)
|
||||
BYTE i,j
|
||||
BYTE ARRAY d
|
||||
|
||||
d=m.data
|
||||
FOR j=0 TO m.height-1
|
||||
DO
|
||||
FOR i=0 TO m.width-1
|
||||
DO
|
||||
PrintB2(d(j*m.width+i)) Put(32)
|
||||
OD
|
||||
PutE()
|
||||
OD
|
||||
RETURN
|
||||
|
||||
PROC Create(MATRIX POINTER m BYTE w,h BYTE ARRAY a)
|
||||
m.width=w
|
||||
m.height=h
|
||||
m.data=a
|
||||
RETURN
|
||||
|
||||
PROC Transpose(Matrix POINTER in,out)
|
||||
BYTE i,j
|
||||
BYTE ARRAY din,dout
|
||||
|
||||
din=in.data
|
||||
dout=out.data
|
||||
out.width=in.height
|
||||
out.height=in.width
|
||||
FOR j=0 TO in.height-1
|
||||
DO
|
||||
FOR i=0 TO in.width-1
|
||||
DO
|
||||
dout(i*out.width+j)=din(j*in.width+i)
|
||||
OD
|
||||
OD
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
MATRIX in,out
|
||||
BYTE ARRAY din(35),dout(35)
|
||||
BYTE i
|
||||
|
||||
FOR i=0 TO 34
|
||||
DO
|
||||
din(i)=i
|
||||
OD
|
||||
Create(in,7,5,din)
|
||||
Create(out,0,0,dout)
|
||||
Transpose(in,out)
|
||||
|
||||
PrintE("Input:")
|
||||
PrintMatrix(in)
|
||||
PutE() PrintE("Transpose:")
|
||||
PrintMatrix(out)
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue