一、 程序填空1. 输入一串数字字符,当其个数为10时,进行各个数字求和运算,否则重新输入.CLEARSET TALK OFFS=0DO WHILE .T.ACCEPT “输入一串数字字符:” TO XM= (1) IF M=10(2) ENDIF(3) ENDDOFOR N=1 TO 10S=S+ (4)
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/31 23:08:56
![一、 程序填空1. 输入一串数字字符,当其个数为10时,进行各个数字求和运算,否则重新输入.CLEARSET TALK OFFS=0DO WHILE .T.ACCEPT “输入一串数字字符:” TO XM= (1) IF M=10(2) ENDIF(3) ENDDOFOR N=1 TO 10S=S+ (4)](/uploads/image/z/11459072-56-2.jpg?t=%E4%B8%80%E3%80%81+%E7%A8%8B%E5%BA%8F%E5%A1%AB%E7%A9%BA1%EF%BC%8E+%E8%BE%93%E5%85%A5%E4%B8%80%E4%B8%B2%E6%95%B0%E5%AD%97%E5%AD%97%E7%AC%A6%2C%E5%BD%93%E5%85%B6%E4%B8%AA%E6%95%B0%E4%B8%BA10%E6%97%B6%2C%E8%BF%9B%E8%A1%8C%E5%90%84%E4%B8%AA%E6%95%B0%E5%AD%97%E6%B1%82%E5%92%8C%E8%BF%90%E7%AE%97%2C%E5%90%A6%E5%88%99%E9%87%8D%E6%96%B0%E8%BE%93%E5%85%A5.CLEARSET+TALK+OFFS%3D0DO+WHILE+.T.ACCEPT+%E2%80%9C%E8%BE%93%E5%85%A5%E4%B8%80%E4%B8%B2%E6%95%B0%E5%AD%97%E5%AD%97%E7%AC%A6%EF%BC%9A%E2%80%9D+TO+XM%3D+%281%29+IF+M%3D10%282%29+ENDIF%283%29+ENDDOFOR+N%3D1+TO+10S%3DS%2B+%284%29)
一、 程序填空1. 输入一串数字字符,当其个数为10时,进行各个数字求和运算,否则重新输入.CLEARSET TALK OFFS=0DO WHILE .T.ACCEPT “输入一串数字字符:” TO XM= (1) IF M=10(2) ENDIF(3) ENDDOFOR N=1 TO 10S=S+ (4)
一、 程序填空
1. 输入一串数字字符,当其个数为10时,进行各个数字求和运算,否则重新输入.
CLEAR
SET TALK OFF
S=0
DO WHILE .T.
ACCEPT “输入一串数字字符:” TO X
M= (1)
IF M=10
(2)
ENDIF
(3)
ENDDO
FOR N=1 TO 10
S=S+ (4)
ENDFOR
”该数字字符各个数字之和为:”,S
SET TALK ON
RETURN
2. 定义一个包含10个元素的A数组,该数组中已有9个数据且按从小到大顺序存放,第10个元素为空,现输入一个数放到数组中,且要求仍为由小到大顺序.
CLEAR
SET TALK OFF
DIME A(10)
FOR K=1 TO 9
INPUT "输入"+ "第"+STR(K,2)+ "个数据" TO A(K)
NEXT
INPUT “输入要插入的数:” TO X
FOR N=1 TO 9
IF A(N)>X
(5)
ENDIF
ENDFOR
FOR M=10 TO N+1 (6)
(7)
NEXT
(8)
FOR K=1 TO 10
A(K)
ENDFOR
SET TALK ON
RETURN
一、 程序填空1. 输入一串数字字符,当其个数为10时,进行各个数字求和运算,否则重新输入.CLEARSET TALK OFFS=0DO WHILE .T.ACCEPT “输入一串数字字符:” TO XM= (1) IF M=10(2) ENDIF(3) ENDDOFOR N=1 TO 10S=S+ (4)
&&这是测试过的程序,请你再测试.
&&1.
CLEAR
SET TALK OFF
S=0
DO WHILE .T.
ACCEPT "输入一串数字字符:" TO X
M=LEN(x)
IF M=10
exit
ENDIF
loop
ENDDO
FOR N=1 TO 10
S=S+VAL(SUBSTR(x,n,1))
ENDFOR
"该数字字符各个数字之和为:",S
SET TALK ON
RETURN
&&2.
CLEAR
SET TALK OFF
DIME A(10)
FOR K=1 TO 9
INPUT "输入"+ "第"+STR(K,2)+ "个数据" TO A(K)
NEXT
INPUT "输入要插入的数:" TO X
FOR N=1 TO 9
IF A(N)>X
exit
ENDIF
ENDFOR
FOR M=10 TO N+1 STEP -1
a(m) =a(m-1)
NEXT
a(N)=x
FOR K=1 TO 10
A(K)
ENDFOR
SET TALK ON
RETURN