ksdf.net
当前位置:首页>>关于vb做出三角形代码的资料>>

vb做出三角形代码

定义好三角形的三个点,用line画线连接即可。 示例如下: Private Sub Form_Load()Me.AutoRedraw = TrueDim x As IntegerDim y As IntegerCurrentX = 1500CurrentY = 500Line -(3000, 2000), RGB(0, 0, 255)Line -(1500, 2000), RGB(0, 0, 255)L...

图示: * *** ***** ******* 假设行数为n,那么第i行开始的空格数为n-i(均以1起始),字符数为2i-1。 for i=1 to n for j=1 to n-i print " " next j for k=1 to 2*i-1 print "*" next k next i

Private Sub Command1_Click() Dim n As Integer Dim i As Integer, j As Integer, k As Integer n = InputBox("输入你要的行数") For i = 1 To n Print Tab(n * 2 - i); For j = 1 To i Print Trim(Str(j)); Next For k = i - 1 To 1 Step -1 P...

Private Sub Command1_Click() n = Val(InputBox("请输入一个正整N")) For i = 1 To n Print Spc(2 * i); For j = 1 To n + 1 - i Print "* "; Next j Print Next i End Sub

在按钮的单击事件里写 For i = 1 To 9 For j = 1 To (10 - i) If (i * j) > 9 Then Print i & " * " & j & " = " & i * j & " "; Else Print i & " * " & j & " = " & i * j & " "; End If Next j Print Next i 标准三角,不因为算式长短而错位

'这个你参考下,是刚给别人写的,你只要在后面加入求周长面积的代码就可以了 Dim a, b, c As Double Dim P As String Private Sub Command1_Click() If IsNumeric(Text1.Text) And IsNumeric(Text2.Text) And IsNumeric(Text3.Text) Then a = Va...

Private Sub Command1_Click() For i = 5 To 1 Step -1 Print Space(10 -i); For j = 2 * i - 1 To 1 Step -1 Print "*"; Next j Print Next i End Sub

一、控制行首的空格数目 二、控制每行的星号数目 三、控制行数。 代码如下: Private Sub Command1_Click() Cls Do 行数 = Int(InputBox("你要多少行?少于一行可以行!")) Loop Until 行数 > 1 For i = 1 To 行数 For j = 1 To i - 1 '行首的空...

用两个嵌套循环语句,一个从1到n,另一个从n到1。其它的自己想把,不难的。

Dim x1, y1, x2, y2 Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button 1 Then Exit Sub x1 = X y1 = Y End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Sin...

网站首页 | 网站地图
All rights reserved Powered by www.ksdf.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com