用vb脚本语言编写一个小程序,程序实现功能如下:任意输入三个整数,使其按大到小的顺序输出。紧急!谢谢

来自:    更新日期:早些时候
程序功能:输入3个整数,按从大到小的顺序进行输出.~

#include int main (void){ int a[3], tem; scanf("%d %d %d", &a[0], &a[1], &a[2]); for (int i = 0; i a[j+1]) { tem = a[j]; a[j] = a[j+1]; a[j+1] = tem; } } } printf("%d %d %d
", a[0], a[1], a[2]); return 0;}

当然能用If嵌套。在窗体上添加4个文本框和1个按钮,Text1、Text2和Text3输入,Text4输出。
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer

a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If a > b Then
If a > c Then
If b > c Then
Text4.Text = a & " " & b & " " & c
Else
Text4.Text = a & " " & c & " " & b
End If
Else
Text4.Text = c & " " & a & " " & b
End If
Else
If b > c Then
If a > c Then
Text4.Text = b & " " & a & " " & c
Else
Text4.Text = b & " " & c & " " & a
End If
Else
Text4.Text = c & " " & b & " " & a
End If
End If
End Sub

a = InputBox("请输入a")
b = InputBox("请输入b")
c = InputBox("请输入c")
If a < b Then
t = a
a = b
b = t
End If
If a < c Then
t = a
a = c
c = t
End If
If b < c Then
t = b
b = c
c = t
End If
MsgBox a & " " & b & " " & c, vbOKOnly, "从大到小的顺序"

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim max As Integer
Dim mid As Integer
Dim min As Integer
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
c = Val(TextBox3.Text)
If a > b Then
If a > c Then
If b > c Then
TextBox4.Text = a
TextBox5.Text = b
TextBox6.Text = c
Else
TextBox4.Text = a
TextBox5.Text = c
TextBox6.Text = b
End If
Else
TextBox4.Text = c
TextBox5.Text = a
TextBox6.Text = b
End If
Else
If b > c Then
If a > c Then
TextBox4.Text = b
TextBox5.Text = a
TextBox6.Text = c
Else
TextBox4.Text = b
TextBox5.Text = c
TextBox6.Text = a
End If
Else
TextBox4.Text = c
TextBox5.Text = b
TextBox6.Text = a
End If
End If
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
End Class


用vb脚本语言编写一个小程序,程序实现功能如下:任意输入三个整数,使其按大到小的顺序输出。紧急!谢谢视频

相关评论:
  • 19273962136用vb脚本语言编写一个小程序,程序实现功能如下:任意输入三个整数,使其...
    刘呢妮MsgBox a & " " & b & " " & c, vbOKOnly, "从大到小的顺序"

  • 19273962136vb环境下编制一小程序
    刘呢妮你好,你想问的是如何使用VB编写一个简单的小程序吧?在桌面上,鼠标左键双击程序,在打开的VB6主界面上,左边是工具菜单栏,单击标签按钮,在Form1窗口上,绘制出一Label1,然后在其属性窗口上改个名字,如Caption为第一数。接着,用同样的方法,在Form1窗口上绘制出第二数,并且在左边工具菜单栏,...

  • 19273962136VB编写小程序
    刘呢妮代码改为:Private Sub Form_Click()Dim a, b, c, d As StringDim sum, aver As Longa = Val(InputBox("请输入第一个数"))b = InputBox("请输入第二个数")c = InputBox("请输入第三个数")d = InputBox("请输入第四个数")sum = a + b + c + d aver = sum \/ 4 Print ...

  • 19273962136Excel中用VB编个小程序excel表格vba编程
    刘呢妮是这样的吗,建一个模块,在里面加入以下代码: Function grade(js As Integer, bs As Integer) If js >= 85 And bs >= 85 Then grade = \\"优秀\\" ElseIf js < 60 And bs < 60 Then grade = \\"不合格\\" Else grade = \\"合格\\" End If End Function ...

  • 19273962136用VB制作小程序
    刘呢妮) Static n As Integer n = n + 1 If n = 60 Then '一秒一次,累加到60此即60秒 n = 0 Randomize Label1.Caption = Int((Rnd * (999999 - 100000 + 1)) + 100000) End IfEnd Sub 有问题请追问,满意请采纳,加油!

  • 19273962136VB一个小程序
    刘呢妮Private Sub timer1_timer() '定时器的定时事件过程 Dim s As Single, m As Single, h As Single Form1.Caption = Time s = Second(Time)m = Minute(Time)h = Hour(Time) + m \/ 60 '绘制秒针 LineS.X2 = LineS.X1 + len_S * Sin(pi * s \/ 30)LineS.Y2 = LineS.Y1 - ...

  • 19273962136小弟需要用vb编写一个打印小程序
    刘呢妮Private Sub Command1_Click()t = "我是中国人。他是日本人。你是哪里人。"tt = Split(t, "。", -1)Label1.Caption = tt(0) & "。"Label2.Caption = tt(1) & "。"Label3.Caption = tt(2) & "。"End Sub '方法二:LABEL1复制粘贴为组控件 Private Sub Command1_Click()t = ...

  • 19273962136用vb编个小程序,关于do while循环,输入数字连续显示中文大写数字_百度...
    刘呢妮Command1执行 Private Sub Command1_Click()Text2 = ""Dim s As Variant s = Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖")n = Len(Text1.Text)i = 1 Do While n <> 0 Text2.Text = Text2.Text & s(Mid(Text1.Text, i, 1))i = i...

  • 19273962136Vb编程编写一个小程序,可以对输入的一段英文字符串进行加密和解密,加 ...
    刘呢妮以下是根据学号末2位加密、解密的VB程序:Private Sub Form_Click()x = Val(Right(Text1.Text, 2)) '取学号末2位 '以下是加密 s = Text2.Text s1 = s For i = 1 To Len(s)c = Mid(s1, i, 1)Mid(s1, i, 1) = Chr(Asc(c) Xor x)Next i Text3.Text = s1 '以下是...

  • 19273962136求一VB小程序!
    刘呢妮If IsNumeric(Text1.Text) And IsNumeric(Text2.Text) _And Not ((Combo1.Text = "÷" Or Combo1.Text = "Mod") And Val(Text2) = 0) Then '判断两个文本框中输入的都是数值 Select Case Combo1.Text Case "+"s = Val(Text1) + Val(Text2)Case "-"s = Val(Text1) - ...

  • 相关主题精彩

    版权声明:本网站为非赢利性站点,内容来自于网络投稿和网络,若有相关事宜,请联系管理员

    Copyright © 喜物网