<%
Dim x,z,b
For x=1 To 10
For b=1 To 10-x
response.Write(" ")
next
For z=1 To 2*x-1
response.Write("*")
Next
response.Write("<br>")
Next
%>
我已经做出三角形了, 怎么做菱形啊。。高手指点下
<%
Dim x,z,b
For x=1 To 10
For b=1 To 10-x
response.Write(" ")
next
For z=1 To 2*x-1
response.Write("*")
Next
response.Write("<br>")
Next
For x=1 To 10
For b=1 To x
response.Write(" ")
next
For z=-19 To -2*x-1
response.Write("*")
Next
<%
Rem 定义Sub子过程 参数n要为奇数
Sub Pic(n)
If n="" Or Not IsNumeric(n) Then Exit Sub '判断n的合法性
Dim i,j,x '声明变量
If n Mod 2 = 0 Then n=n+1 '如果n为偶数则加1使之为奇数
x=n '把n的值赋给x
For i=1 To x '循环行
For j=1 To x '循环列
If i<x\2+1 Then '判断是上边的
If j>x\2+1+i-1 Or j<x\2+1-i+1 Then Response.Write(" ") Else Response.Write("*")
'这里有一些算法 来做判断
ElseIf i>x\2+1 Then '判断是下边的
If j>x-(i-x\2)+1 Or j<(i-x\2) Then Response.Write(" ") Else Response.Write("*")
'这里也一样
Else '判断是中间的
Response.Write("*")
End If
Next
Response.Write("<br>") '换行
Next
End Sub
Call Pic(13) '调用Sub
%>