vb简易计算机器程序,vb简易计算器源码

代码如下:

/**

*Author:乌鸟heart

*Version:1.0

*/

Dim IntX As Double '全局变量,用于存储计算的数值

Dim IntOperation As Double '标记运算类型

Dim isBegin As Boolean '标记是否已经给IntX赋值

Public Sub Clear() '清空命令函数

screen.Caption = ""

End Sub

Public Sub SavaToIntX()

Select Case IntOperation

Case 1 '加法

If isBegin = False Then

IntX = Val(screen.Caption)

isBegin = True

Else

IntX = IntX + Val(screen.Caption)

End If

Case 2 '减法

If isBegin = False Then

IntX = Val(screen.Caption)

isBegin = True

Else

IntX = IntX - Val(screen.Caption)

End If

Case 3 '乘法

If isBegin = False Then

IntX = Val(screen.Caption)

isBegin = True

Else

IntX = IntX * Val(screen.Caption)

'screen.Caption = IntX

End If

Case 4 '除法

If isBegin = False Then

IntX = Val(screen.Caption)

isBegin = True

Else

IntX = IntX / Val(screen.Caption)

End If

End Select

End Sub

Private Sub Command0_Click()

screen.Caption = screen.Caption & 0

End Sub

Private Sub Command1_Click()

screen.Caption = screen.Caption & 1

End Sub

Private Sub Command2_Click()

screen.Caption = screen.Caption & 2

End Sub

Private Sub Command3_Click()

screen.Caption = screen.Caption & 3

End Sub

Private Sub Command4_Click()

screen.Caption = screen.Caption & 4

End Sub

Private Sub Command5_Click()

screen.Caption = screen.Caption & 5

End Sub

Private Sub Command6_Click()

screen.Caption = screen.Caption & 6

End Sub

Private Sub Command7_Click()

screen.Caption = screen.Caption & 7

End Sub

Private Sub Command8_Click()

screen.Caption = screen.Caption & 8

End Sub

Private Sub Command9_Click()

screen.Caption = screen.Caption & 9

End Sub

Private Sub CommandClear_Click() '清空命令

isBegin = False

IntOperation = 0

IntX = 0

screen.Caption = ""

End Sub

Private Sub CommandEqual_Click() '等号运算

If IntOperation <> 0 Then '有运算标记的情况

Call SavaToIntX

IntOperation = 0

isBegin = False

screen.Caption = IntX

End If

End Sub

Private Sub CommandMinus_Click() '减法运算

If IntOperation <> 0 Then '有运算标记的情况

Call SavaToIntX

IntOperation = 2

Call Clear

Else

IntOperation = 2

Call SavaToIntX

Call Clear

End If

End Sub

Private Sub CommandMultiple_Click() '乘法运算

If IntOperation <> 0 Then '有运算标记的情况

Call SavaToIntX

IntOperation = 3

Call Clear

Else

IntOperation = 3

Call SavaToIntX

Call Clear

End If

End Sub

Private Sub CommandPlus_Click() '加法运算

If IntOperation <> 0 Then '有运算标记的情况

Call SavaToIntX

IntOperation = 1

Call Clear

Else

IntOperation = 1

Call SavaToIntX

Call Clear

End If

End Sub

Private Sub CommandSlash_Click() '除法运算

If IntOperation <> 0 Then '有运算标记的情况

Call SavaToIntX

IntOperation = 4

Call Clear

Else

IntOperation = 4

Call SavaToIntX

Call Clear

End If

End Sub

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/441496.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【CodeForces - 1038B 】Non-Coprime Partition (构造,数组特征)

题干&#xff1a; Find out if it is possible to partition the first nn positive integers into two non-empty disjoint sets S1S1 and S2S2 such that: gcd(sum(S1),sum(S2))>1gcd(sum(S1),sum(S2))>1 Here sum(S)sum(S) denotes the sum of all elements presen…

计算机专业用锐龙笔记本,轻松应对工作挑战——ThinkPad T14 锐龙版,适合办公的笔记本电脑...

拥有一部适合办公的笔记本电脑&#xff0c;可以成为商务人士忙碌工作中强有力的支持。联想旗下的ThinkPad 系列笔记本电脑&#xff0c;一直秉持为高端商务人士服务的理念&#xff0c;以稳定、流畅、安全的使用体验得到广泛认可。其中的ThinkPad T14 锐龙版&#xff0c;更是有着…

python tabula 使用方法_Python中os.walk()的使用方法

os.walk()主要用来扫描某个指定目录下所包含的子目录和文件。这篇文章将通过几个简单的例子来说明python中os.walk()的使用方法。假设我们的test文件夹有如下的目录结构&#xff1a;我们首先用os.walk扫描test文件夹下所有的子目录和文件&#xff1a;# 使用os.walk扫描目录 imp…

【CodeForces - 1038C】Gambling (博弈问题,优先队列模拟,贪心)

题干&#xff1a; Two players A and B have a list of nn integers each. They both want to maximize the subtraction between their score and their opponents score. In one turn, a player can either add to his score any element from his list (assuming his list…

乐乐勇智能教育机器人有多少型号_【头条】协作机器人平台化趋势将会是柔性自动化的破局之道...

智能机器人商情微信公众号&#xff0c;关注中国智能机器人行业热点与发展趋势&#xff0c;打造快捷高效的行业资讯交互平台。更多精彩内容&#xff0c;您可以点击标题下方的蓝字关注我们。导语艾利特平台级CS系列协作机器人全新发布9月15日上海工博会第一天&#xff0c;艾利特机…

计算机毕设结束语致谢,毕业设计结束语和致谢

毕业设计结束语和致谢时间&#xff1a;2021-01-17 20:08:40 分类&#xff1a;小结范文 | 毕业论文致谢词范文 | Word文档下载毕业设计结束语和致谢导语&#xff1a;论文致谢应以简短的文字对课题研究与论文撰写过程中间直接给予帮助的人员(例如指导教师、答疑教师及其他人员)…

*【HDU - 2819】Swap(二分图匹配,输出路径)(待证明:是否是最少交换次数?)

题干&#xff1a; Given an N*N matrix with each entry equal to 0 or 1. You can swap any two rows or any two columns. Can you find a way to make all the diagonal entries equal to 1? Input There are several test cases in the input. The first line of each …

CSS中属性个属性值怎么区分,[CSS] 详细解释 @media 属性与 (max

前言现在 HTML5/CSS3 很流行罢&#xff0c;也是未来时代的趋势。在 HTML5 带来的许多实用功能之后&#xff0c;CSS3也同带来了一些牛逼哄哄的功能呢。动画 animation转化 transform过渡 translation尽快这已足够让我们兴奋&#xff0c;许多之前必须用 JS 或 JQ 写的效果用 CSS …

西门子精智和精简面板区别_西门子S7-1200的功能与特点,应用范围介绍

S7-1200是西门子公司新推出的一款面向离散自动化系统和独立自动化系统的低端PLC。S7-1200采用了模块化设计&#xff0c;具备强大的工艺功能&#xff0c;适用于多种场合&#xff0c;可以满足不同的自动化需求。S7-1200的定位处于原有的SIMATIC S7-200和SIMATIC S7-300之间&#…

【HDU - 1281 】棋盘游戏 (经典的二分图匹配,匈牙利算法,枚举删除顶点,必须边,关建边)

题干&#xff1a; 小希和Gardon在玩一个游戏&#xff1a;对一个N*M的棋盘&#xff0c;在格子里放尽量多的一些国际象棋里面的“车”&#xff0c;并且使得他们不能互相攻击&#xff0c;这当然很简单&#xff0c;但是Gardon限制了只有某些格子才可以放&#xff0c;小希还是很轻松…

eclipse提示方法已过时_提高效率,eclipse上你可能不知道的技巧

一张思维导图1、控制台(console )日志输出另保存经常会遇到这种情况&#xff0c;习惯性的清掉控制台上的输出日志&#xff0c;再然后发现刚才的日志居然还有用&#xff0c;不得不又重新调试一遍&#xff0c;为了解决这种“手贱”的问题&#xff0c;我在网上搜了一些资料&#x…

【CodeForces - 144B 】Meeting (暴力枚举,水题,计算几何)

题干&#xff1a; The Super Duper Secret Meeting of the Super Duper Secret Military Squad takes place in a Super Duper Secret Place. The place is an infinite plane with introduced Cartesian coordinate system. The meeting table is represented as a rectangle…

html中超链接使用_干货 | HTML中表格的使用方法

HTML中的表格是由表格的标签组成HTML中的表格是由标签用于定义表格的列&#xff0c;标签为又是标签来分割列&#xff0c;形成一个完整的表格。表格的标签组合关系为&#xff1a;我是单元格1我是单元格2表格中可以插入文本、图片、列表、段落、表单、水平线等任何html标签&#…

chrome插件中调用ajax,Chrome扩展程序中的Ajax调用无效

尝试在Chrome扩展程序中发送ajax请求。我已经确认请求返回200响应&#xff0c;它应该只是console.log来测试&#xff06;&#xff03;39;。我不确定这里是否存在异常问题&#xff1f;我已经阅读了Chrome扩展程序&#xff06;&#xff03;39; addListener&#xff06;&#xff0…

【CodeForces - 144C】Anagram Search(尺取,滑窗问题,处理字符串计数)

题干&#xff1a; A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "…

互补品的交叉弹性系数_重庆事业单位综合备考:需求价格弹性和需求交叉价格弹性有何区别...

需求价格弹性 VS 需求交叉价格弹性一、需求价格弹性指某种商品随着价格的变化&#xff0c;该商品需求变化的程度大小(这里指的是同一种商品)。或者说&#xff0c;是需求变化相对于价格变化的敏感程度。假设&#xff1a;黄金、IPONE手机等商品降价50%&#xff0c;一定会大卖&…

esxi服务器与虚拟机时间不符,vsphere6.7-虚拟机与ESXI时间同步

ELF Format 笔记(十五)—— 符号哈希表ilocker:关注 Android 安全(新手) QQ: 2597294287 符号哈希表用于支援符号表的访问,能够提高符号搜索速度. 下表用于解释该哈希表的组织,但该格式并不属于 ELF 规范. ...AD域修改组策略如果我们的计算机加入AD域之后,修改安全策略时不能用…

朋友圈自动回复评论_微信新版,朋友圈可以表情包回复了!网友:评论区斗起来.jpg...

你们发现了吗&#xff1f;朋友圈可以发表情包评论了&#xff01;微信iOS版7.0.9正式版今天迎来更新支持发消息时可以引用之前的内容更令人惊喜的是不少网友都发现新版本还新增朋友圈自定义表情评论功能可以用表情包评论别人的朋友圈内容了&#xff01;轻触表情包还可以查看大图…

【CodeForces - 144D】Missile Silos(单源最短路,枚举中间边,枚举情况可能性)

题干&#xff1a; A country called Berland consists of n cities, numbered with integer numbers from 1to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. Accordi…

第九大陆服务器未找到文件,第九大陆服务器优化规则说明 拍卖行和寄售功能关闭公告...

第九大陆已经确定了六月份服务器的优化时间与规则&#xff0c;同时为了配合6月8日的服务器优化实施&#xff0c;拍卖行将于6月5日关闭&#xff0c;待服务器优化完成后即可开放&#xff01;给大家带来的不便&#xff0c;敬请您谅解&#xff01;《第九大陆》服务器优化详细规则说…