我有一个问题,当我输入数字2,5,7时,结果是可以的,而当我输入数值1,3,4,6时,结果不匹配。
define variable oct as character.
define variable l-oct as integer.
define variable oktal as integer.
define variable l-oktal as integer.
define variable count as integer.
define variable i as integer.
define variable bin as character.
define variable bin2 as character.
end.
do i = length(bin) to 1 by -1:
bin2 = bin2 + substring(bin, i, 1).
end.
display bin2 with frame a down.
您的if
else if
列车缺少一个else if
。if
else if
列车通常由case
语句提供更好的服务。
此外,您首先要以三位二进制字符串为一组构造一个从后到前的,然后在 每一位所以在八进制 带有:1
变成二进制001
的地方,你把它翻转成100
。不要在之后翻转,而是正确地连接字符串以开始,因此替换所有出现的:bin = bin + 'xxx'
bin = 'xxx' + bin