如何使用progress-4gl以三角形方式显示数字

时间:2016-09-23 09:17:48

标签: progress-4gl openedge

如何使用progress4gl框架以三角形图案显示数字? 请帮助我。

E.g。

           1         OR             1
         1 1 1                    1 2 3
       1 1 1 1 1                 1 2 3 4 5
     1 1 1 1 1 1 1.            1 2 3 4 5 6 7

2 个答案:

答案 0 :(得分:1)

对用例真的很好....但是:

DEFINE VARIABLE i AS INTEGER NO-UNDO . 

DO  i = 1 TO 5:

    DISPLAY FILL (" ", (6 - i) * 2) + FILL ("1 ", i * 2 - 1) FORMAT "x(40)" WITH DOWN STREAM-IO.
    DOWN 1. 

END.

接近。

答案 1 :(得分:1)

DEFINE VARIABLE i      AS INTEGER NO-UNDO . 
DEFINE VARIABLE j      AS INTEGER NO-UNDO . 

DEFINE VARIABLE cLine AS CHARACTER FORMAT "x(40)" NO-UNDO.

DO  i = 1 TO 5:

    cLine = FILL (" ", (6 - i) ) .

    DO j = 1 TO i:
        cLine = cLine + STRING (j * 2 - 1) + " ".
    END.

    DISPLAY cLine WITH DOWN STREAM-IO.
    DOWN 1. 

END.