cobol学习之五简单输入成绩的计算
cobol学习之五简单输入成绩的计算

cobol学习之五简单输入成绩的计算
• 发表于 1年前
• 阅读 8
• 收藏 0
• 评论 0

``````000010 IDENTIFICATION 			DIVISION.
000020  PROGRAM-ID.			STUDY2-009.
000030 ENVIRONMENT			DIVISION.
000040 DATA				DIVISION.
000050  WORKING-STORAGE			SECTION.
000060 77				SNO PIC X(5) VALUE '10011'.
000070 77				SNAME PIC X(8) VALUE 'ZHANGSAN'.
000080 77				SX PIC 999V9.
000090 77				YW PIC 999V9.
000100 77				RY PIC 999V9.
000110 77				ZY PIC 999V9.
000111 77				ZJ PIC 999V9.
000112 77				PJF PIC 999V9.
000113 77				SX-P PIC 999.9.
000114 77				YW-P PIC 999.9.
000115 77				RY-P PIC 999.9.
000116 77				ZY-P PIC 999.9.
000117 77				ZJ-P PIC 999.9.
000118 77				PJF-P PIC 999.9.
000120 PROCEDURE 			DIVISION.
000130  INPUTNUMBER			SECTION.
000131     DISPLAY 'SX:' WITH NO ADVANCING.
000140     ACCEPT SX.
000141     DISPLAY 'YW:' WITH NO ADVANCING.
000142     ACCEPT YW.
000143     DISPLAY 'RY:' WITH NO ADVANCING.
000144     ACCEPT RY.
000145     DISPLAY 'ZY:' WITH NO ADVANCING.
000146     ACCEPT ZY.
000150   COMPUTENUMBER			SECTION.
000160     COMPUTE ZJ = SX + YW + RY + ZY
000170     COMPUTE PJF = ZJ / 4.
000171   MOVENUMBER			SECTION.
000172	   MOVE SX TO SX-P
000173	   MOVE YW TO YW-P
000174	   MOVE RY TO RY-P
000175	   MOVE ZY TO ZY-P
000176	   MOVE ZJ TO ZJ-P
000177	   MOVE PJF TO PJF-P.
000180   DISPLAYNUMBER			SECTION.
000190     DISPLAY 'SX=' SX-P
000200     DISPLAY 'YW=' YW-P
000210     DISPLAY 'RY=' RY-P
000220     DISPLAY 'ZY=' ZY-P
000230     DISPLAY 'ZJ=' ZJ-P
000240     DISPLAY 'PJF=' PJF-P
000250     STOP RUN.``````

×