作业帮 > 综合 > 作业

求高手做几道程序题,只要写出结果就可以了.

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/10 17:45:08
求高手做几道程序题,只要写出结果就可以了.
1、程序代码:
SET TALK OFF
CLEAR
A=’ABCDEFGH’
N=LEN(A)
FOR I=1 TO N SETP 2
SUBSTR(A,N-I-1,2)
ENDFOR
SET TALK ON
2、设N值为4,字符”A”的ASCII码为65.
程序代码:
SET TALK OFF
CLEAR
INPUT "N=" TO N
FOR I=1 TO N
SPACE(NI+1)
FOR J=1 TO 2*I1
CHR(ASC("A")+J1)
ENDFOR
ENDFOR
FOR P=N-1 TO 1 STEP 1
SPACE(N-P+1)
FOR K=1 TO 2*P1
CHR(ASC("A")+K1)
ENDFOR
ENDFOR
SET TALK ON
3、设N,M的值分别为6,8.
程序代码:
SET TALK OFF
CLEAR
INPUT "N=" TO N
INPUT "M=" TO M
X=MIN(N,M)
FOR I=X TO 1 STEP -1
IF M/I=INT(M/I) AND N/I=INT(N/I)
Y1=I
EXIT
ENDIF
ENDFOR
"Y1="+ALLTRIM(STR(Y1,19))+",Y2="+ALLTRIM(STR(M*N/Y1,19))
SET TALK ON
4、设输入的数值N为5
SET TALK OFF
CLEAR
INPUT “N=” TO N
DIME A(N,N)
P=N
DO WHILE N>0
A(N,N)=1
A(N,1)=1
N=N-1
ENDDO
FOR I=3 TO P
FOR J=2 TO I-1
A(I,J)=A(I-1,J-1)+A(I-1,J)
ENDFOR
ENDFOR
FOR I=1 TO P
SPACE(3*(P-I+1)
FOR J=1 TO I
STR(A(I,J),3)
ENDFOR
ENDFOR
SET TALK ON
5、SET TALK OFF
A=”ABCDEFGHIJKLMNOPQRSTUVWXYZ”
B=LEN(A)
X=”X_”
Y=”Y_”
I=1
DO WHILE I
求高手做几道程序题,只要写出结果就可以了.
所有的中文引号改为西文单引号
1,SET TALK OFF
CLEAR
A='ABCDEFGH'
N=LEN(A)
FOR I=1 TO N SETP 2
SUBSTR(A,N-I-1,2)
ENDFOR
SET TALK ON
FGEFDECDBCAB
2,
SET TALK OFF
CLEAR
INPUT "N=" TO N
FOR I=1 TO N
SPACE(N+I+1)
FOR J=1 TO 2*I
CHR(ASC("A")+J)
ENDFOR
ENDFOR
FOR P=N-1 TO 1 STEP 1
SPACE(N-P+1)
FOR K=1 TO 2*P
CHR(ASC("A")+K1)
ENDFOR
ENDFOR
SET TALK ON
输入N=4
结果
BC
BCDE
BCDEFG
BCDEFGHI
3,N=6
M=8
输出:
Y1=2,Y2=24
4,SPACE(3*(P-I+1)改为 SPACE(3*(P-I+1))
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
5,
X_ABCDEFGHIJKLMNOPQRSTUVWDXYZ
Y_BFDHJLNPRTVXZ
6,
7 5 G丙
5 3 G丙E乙
11 1 G丙E乙甲
7,
M= *#*#*#
Y= 6
8,
ENDIFn 去掉n
Y1=2,Y2=24