| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1164 人关注过本帖
标题:求助简易计算器的代码
只看楼主 加入收藏
老耶
Rank: 1
来 自:广东
等 级:新手上路
帖 子:6
专家分:2
注 册:2010-5-23
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:3 
求助简易计算器的代码
那位大哥帮帮忙,小弟很需要简易计算器1——9和+、-、*、/、=的代码!!
搜索更多相关主题的帖子: 计算器 代码 
2010-05-31 18:15
sywzs
Rank: 10Rank: 10Rank: 10
来 自:辽宁
等 级:贵宾
威 望:15
帖 子:508
专家分:1725
注 册:2009-5-13
收藏
得分:20 
参考这个吧。
计算器.rar (70.58 KB)
2010-06-01 08:31
xiaohui1014
Rank: 1
来 自:天津
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-5-28
收藏
得分:0 
Public Class Form1
    Dim arr(9) As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        Randomize()
        TextBox1.Text = ""
        For i = 0 To 9
            arr(i) = 10 + Math.Floor(Rnd() * 90)
            TextBox1.Text &= arr(i) & " "
        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim i, j, temp As Integer
        For i = 0 To 8
            For j = i + 1 To 9
                If arr(i) > arr(j) Then
                    temp = arr(i)
                    arr(i) = arr(j)
                    arr(j) = temp
                End If
            Next
        Next
        TextBox2.Text = ""
        For i = 0 To 9
            TextBox2.Text &= arr(i) & " "
        Next
    End Sub
End Class
 Public Class Form1
    Dim Num1 As Double  '被+-*/数
    Dim opr As String '运算符
    Dim oprPressed As Boolean = False
    Private Sub btnNum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click, btn2.Click, btn3.Click, btn4.Click, btn5.Click, btn6.Click, btn7.Click, btn8.Click, btn9.Click, btn10.Click, btn11.Clickbtn
        Dim btn As Button = CType(sender, Button)
        If oprPressed Then
            Label1.Text = btn.Text
            oprPressed = False
        Else
            Label1.Text = CDbl(Label1.Text & btn.Text)
        End If

    End Sub
    Private Sub btnOpr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn12.Click, btn13.Click, btn14.Click, btn15.Click
        Dim btn As Button = CType(sender, Button)
        opr = btn.Text
        oprPressed = True
        Num1 = CDbl(Label1.Text)
    End Sub
    Private Sub btn16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn16.Click
        Select Case opr
            Case "+"
                Label1.Text = Num1 + CDbl(Label1.Text)
            Case "-"
                Label1.Text = Num1 - CDbl(Label1.Text)
            Case "*"
                Label1.Text = Num1 * CDbl(Label1.Text)
            Case "/"
                Label1.Text = Num1 / CDbl(Label1.Text)

        End Select
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
2010-06-01 10:55
adad4456361
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-4-10
收藏
得分:0 
Dim i, j, temp As Integer
        For i = 0 To 8
            For j = i + 1 To 9
                If arr(i) > arr(j) Then
                    temp = arr(i)
                    arr(i) = arr(j)
                    arr(j) = temp
                End If
            Next
        Next
        TextBox2.Text = ""
        For i = 0 To 9
            TextBox2.Text &= arr(i) & " "
        Next
大侠请解释下这代码的的意思和用意好么
2013-04-13 00:29
快速回复:求助简易计算器的代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034792 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved