繁體中文
当前位置:首页 > 信息世界 > 程序源码 > 详细内容
『vfp』三角形式的数叠加
发布时间:2009/7/5  阅读次数:1110  字体大小: 【】 【】【

例n=5,输出形式如下:
                       1
                 1  1
           1  2  1
     1 3 3 1
1 4  6 4 1


1.首先建立一个名为sj的表单
建立modi comm   sj

2.在表单中输入以下语句:
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

3.运行do sj

我要评论
  • 匿名发表
  • [添加到收藏夹]
  • 发表评论:(匿名发表无需登录,已登录用户可直接发表。) 登录状态:未登录
最新评论
所有评论[0]
    暂无已审核评论!
 
 版权声明     关于本站      在线留言       登陆管理      个人博客   
 『辰桦网络』. All Rights Reserved
Station construction time: on April 4, 2006