希望大家帮我用这种VFP方法解决输出杨辉三角啊

2025-01-01 00:29:20
推荐回答(1个)
回答1:

CLEAR
SET TALK OFF
Local i,j
Dime A(i,j)
For nRow = 1 To i
A(nRow,1) = 1
For nCol = 2 To nRow - 1
A(nRow,nCol) = A(nRow - 1,nCol - 1) + A(nRow - 1,nCol)
EndFor
A(nRow,nRow) = 1
EndFor
For m = 1 To i
cc = ''
For n = 1 To m
cc = cc + alltrim(Str(A(m,n))) + ' '
EndFor
? Padc(cc,100)
EndFor