Added comments to rectangle prorgam
This commit is contained in:
parent
d472caa320
commit
bec53bad12
|
@ -1,19 +1,38 @@
|
||||||
OUT I will draw a rectangle\n
|
OUT I will draw a rectangle\n
|
||||||
|
#show welcome message
|
||||||
INT w
|
INT w
|
||||||
|
#initialize width
|
||||||
INT h
|
INT h
|
||||||
|
#initialize height
|
||||||
IN INT w l
|
IN INT w l
|
||||||
|
#input height as an int
|
||||||
IN INT h h
|
IN INT h h
|
||||||
|
#input width as an int
|
||||||
INT wr
|
INT wr
|
||||||
|
#initialize width counter
|
||||||
INT hr
|
INT hr
|
||||||
|
#initialize height counter
|
||||||
SET wr 0
|
SET wr 0
|
||||||
|
#set width counter to 0
|
||||||
SET hr 0
|
SET hr 0
|
||||||
|
# set height counter to 0
|
||||||
:wrc
|
:wrc
|
||||||
|
#row label
|
||||||
:wf
|
:wf
|
||||||
|
#column label
|
||||||
OUT *
|
OUT *
|
||||||
|
#put char
|
||||||
INC wr
|
INC wr
|
||||||
|
#increment width counter
|
||||||
JL wf wr w
|
JL wf wr w
|
||||||
|
#loop until desired width
|
||||||
OUT \n
|
OUT \n
|
||||||
|
#put newline char
|
||||||
SET wr 0
|
SET wr 0
|
||||||
|
# set width counter to 0
|
||||||
INC hr
|
INC hr
|
||||||
|
#increment height counter
|
||||||
JL wrc hr h
|
JL wrc hr h
|
||||||
|
#loop until desired height
|
||||||
END
|
END
|
||||||
|
#quit
|
||||||
|
|
Reference in New Issue
Block a user