当前位置:首页 > 新闻资讯 > 站长休闲 > > 关于ASP中FOR循环的小应用

关于ASP中FOR循环的小应用

点击次数:33 次 发布日期:2008-11-18 13:31:45 作者:源代码网
源代码网推荐

源代码网整理以下          今天一大学同学突然问我一编程问题,让我用ASP帮她编写输出一如下图形:

源代码网整理以下      *
    ***
  *****
*******

源代码网整理以下         一时间我还想不起该怎么回答了,相当惭愧。研究了半天才写出来了,感觉相当丢人。代码如下:

源代码网整理以下<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

源代码网整理以下<body>
<%
 dim n,i,a,b
 for n=1 to 7 step 2
  i = 0
  a = 0
  b = (7 - n)/2
  for a = 1 to b
   response.write "&nbsp;&nbsp;"
  next
  
  for i = 1 to n
   response.write "*"
  next
  response.write "<br>"
 next
%>
</body>
</html>

源代码网整理以下本文章出自Shuro"s Blog(http://www.shuro.cn),转载请注明出处,谢谢!

源代码网供稿.
网友评论 (0)
会员中心
新闻资讯
本站推荐
新闻资讯之精华