RPG 4 中的模数?
The modulo in RPG 4?
有人知道我如何在 RPG IV 中进行取模吗?
我试过 %2 = 0
但不准确!
如果你有解决方案,我很感兴趣。
dcl-s slash varchar(20);
dcl-s antiSlash varchar(20);
dcl-s i packed(3:0);
dcl-s j packed(3:0);
dcl-s k packed(3:0);
dcl-s message varchar(20);
dcl-s waitInput char(1);
FOR i = 1 by 1 to 10;
slash += '/';
ENDFOR;
FOR j = 1 by 1 to 10;
antiSlash += '\';
ENDFOR;
FOR k = 1 by 1 to 6;
IF k % 2 = 0;
message = %char(slash);
dsply message ' ' waitInput;
ENDIF;
ENDFOR;
*INLR = *on;
Tradition Fix-format Free Format Syntax
Division Remainder MVR (Move Remainder) %REM (Return Integer Remainder)
所以对于您的代码...
if %rem(k:2) = 0;
有人知道我如何在 RPG IV 中进行取模吗?
我试过 %2 = 0
但不准确!
如果你有解决方案,我很感兴趣。
dcl-s slash varchar(20);
dcl-s antiSlash varchar(20);
dcl-s i packed(3:0);
dcl-s j packed(3:0);
dcl-s k packed(3:0);
dcl-s message varchar(20);
dcl-s waitInput char(1);
FOR i = 1 by 1 to 10;
slash += '/';
ENDFOR;
FOR j = 1 by 1 to 10;
antiSlash += '\';
ENDFOR;
FOR k = 1 by 1 to 6;
IF k % 2 = 0;
message = %char(slash);
dsply message ' ' waitInput;
ENDIF;
ENDFOR;
*INLR = *on;
Tradition Fix-format Free Format Syntax
Division Remainder MVR (Move Remainder) %REM (Return Integer Remainder)
所以对于您的代码...
if %rem(k:2) = 0;