早教吧作业答案频道 -->数学-->
COBOL到底能不能做出计算器来?源码:IDENTIFICATIONDIVISION.PROGRAM-ID.LYX12.ENVIRONMENTDIVISION.DATADIVISION.WORKING-STORAGESECTION.77KPIC9(9).77OPIC9(9).77APIC9(9).PROCEDUREDIVISION.DISPLAY"ENTERTHESTEP".ACCEPTO.ACCEPT
题目详情
COBOL到底能不能做出计算器来?
源码:IDENTIFICATION DIVISION.
PROGRAM-ID.LYX12.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 K PIC 9(9).
77 O PIC 9(9).
77 A PIC 9(9).
PROCEDURE DIVISION.
DISPLAY "ENTER THE STEP".
ACCEPT O.
ACCEPT K.
COMPUTE A = K + O.
DISPLAY "THE MAXMIUM OF Y IS ",A.
STOP RUN.
如果O传入的是11,K传入的是12的话A的结果是+230000000而其实想要的结果只是23
源码:IDENTIFICATION DIVISION.
PROGRAM-ID.LYX12.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 K PIC 9(9).
77 O PIC 9(9).
77 A PIC 9(9).
PROCEDURE DIVISION.
DISPLAY "ENTER THE STEP".
ACCEPT O.
ACCEPT K.
COMPUTE A = K + O.
DISPLAY "THE MAXMIUM OF Y IS ",A.
STOP RUN.
如果O传入的是11,K传入的是12的话A的结果是+230000000而其实想要的结果只是23
▼优质解答
答案和解析
IDENTIFICATION DIVISION.
PROGRAM-ID. LYX12.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 K PIC X(9).
77 O PIC X(9).
77 A PIC 9.
77 B PIC 9.
77 C PIC 9(9).
77 D PIC 9(9).
77 E PIC Z(9).
PROCEDURE DIVISION.
DISPLAY "ENTER THE STEP".
ACCEPT O.
ACCEPT K.
INSPECT O TALLYING A FOR ALL " ".
COMPUTE A = 9 - A.
MOVE O(1:A) TO C.
INSPECT K TALLYING B FOR ALL " ".
COMPUTE B = 9 - B.
MOVE K(1:B) TO D.
COMPUTE E = C + D.
DISPLAY "THE MAXMIUM OF Y IS ", E.
STOP RUN.
PROGRAM-ID. LYX12.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 K PIC X(9).
77 O PIC X(9).
77 A PIC 9.
77 B PIC 9.
77 C PIC 9(9).
77 D PIC 9(9).
77 E PIC Z(9).
PROCEDURE DIVISION.
DISPLAY "ENTER THE STEP".
ACCEPT O.
ACCEPT K.
INSPECT O TALLYING A FOR ALL " ".
COMPUTE A = 9 - A.
MOVE O(1:A) TO C.
INSPECT K TALLYING B FOR ALL " ".
COMPUTE B = 9 - B.
MOVE K(1:B) TO D.
COMPUTE E = C + D.
DISPLAY "THE MAXMIUM OF Y IS ", E.
STOP RUN.
看了 COBOL到底能不能做出计算...的网友还看了以下:
将连续的自然数1至36按如图的方式排成一个正方形数列,用一个小正方形任意圈出其中的9个数,设圈出的 2020-05-16 …
用列举法的集合问题题目是这样的:A={X∈N|9-X/9∈N}用列举法表示出来....9-X/9为 2020-05-17 …
硅二极管整流器中,通过每个二极管的平均电流Ia是输出电流Id的()。A.1/6B.1/3C.1/2D 2020-05-31 …
如图所示,每个圆周上的数是按下述规则逐次标注的:第一次现在圆周上标出1/9,2/9两个数(如图甲) 2020-06-20 …
将连续的自然数1至36按图的方式排列成一个正方形阵列,用一个小正方形任意圈出9个数,设圈出的9个数 2020-07-18 …
将连续自然数1至366按如图所示的方式排成一个长方形阵列,用一个小正方形任意圈出其中的9个数,设圈出 2020-11-03 …
小学六年级数学题将连续自然数1---2008按下图方式排成一个方阵,用正方形框出9个数。1.如右图, 2020-11-07 …
mysql多表查询急急急我有两个表A表下有7条数据B表下有4条数据现在我想以字段id为准输出7条记录 2020-11-20 …
现将自然数1~2014按图中的方式排成一个长方形阵列,用一个长方形框出9个数:(1)图中的9个数的和 2020-11-20 …
将连续的自然数1至1001按如图的方式排列成一个长方形阵列,用一个正方形框出9个数,要使这个正方形框 2020-12-24 …