关于asp中的一些问题

来源:百度知道 编辑:UC知道 时间:2024/05/27 02:19:10
下面是源码,可以产生金字塔的效果

<p align=center>

<%

for i= 0 to 10

a=a&"※"

response.Write(a)
response.Write("<br>")
next
%>
</p>

那么要想生成倒立的金字塔该如何修改源代码那?

<p align=center>
<%
for j=10 to 0 step -1
for i= 0 to j
a="※"
response.Write(a)
next
response.Write("<br>")
next
%>
</p>

应该是这样地:

<p align=center>

<%
a="※※※※※※※※※※※"
for i= 0 to 10

a= left(a,len(a)-1)

response.Write(a)
response.Write("<br>")
next
%>
</p>

Str = "※※※※※※※※※※※"
CountStr = Len(Str)

For i= 0 to CountStr - 1
Str = Left(Str,CountStr-i)
Response.Write(Str&"<br>")
Next

for i= 10 to 0 step -1

以上都可行