- 博客(14)
- 收藏
- 关注
原创 判断该年是否为闰年,并根据给定的月份判断该月有多少天
闰年是可被4整除不能被100整除,即:y Mod 4=0 And y Mod100 Private Sub Command1_Click() Dim y As Integer, m As Integer, days As Integer Dim leap As Boolean If Text1.Text="
2012-05-31 09:13:59
4720
原创 在文本框中输入任一串英文字符,将他们进行大小写转换
包含1个label1 ,1个text1和3个按钮。 Private Sub Text1_KeyUp (KeyCode As Integer, Shift As Integer) Text1.Tag=Text1.Text End Sub Private Sub Form_Activate() Text1.SetFocusEnd SubP
2012-05-31 08:23:11
1136
原创 复习时所知内容1
1,整除的符号是“\”,不进行四舍五入,直接得出整数部分。 2,符号的优先级:^幂运算,-负号,*乘,/ 除,\ 整除,mod取余数,+加,- 减,& 和+连接,等于不等于号,not ,and,or , xor 异或,eqv 等价,imp 蕴含,=赋值 3,数学函数:Abs(X) 绝对值函数,Sgn(X) 符号函数,Exp(X) 幂运算函数 4,I
2012-05-30 20:26:05
285
原创 点击按钮1时出现拖动框,点击按钮2时不出现,并将mytextbox中的任意字符在vb.text中输出
dim withevents mytextbox as vb.textbox private sub command1-click() 'dim mytextbox as vb.textbox setmytextbox=me.controls.add("vb.textbox","mytextbox")mytextbox.move me.command1.left-
2012-05-24 08:53:51
423
原创 使用模块通用编写任输出n个不相等的数
private sub command1-click() n=intput box("请输入一个正整数") dim str2 as string call getninteger(n,str2) label1.caption=left(str2,len(str2)-1)end sub 模块中:sub getninteger(byval n as
2012-05-17 08:20:49
190
原创 10个随机数中没有重复的数
上几节课上老师让写过一个随机生成10个数,这节课上又指出10个数中没有重复的数,过程如下: private sub command1-click() dim a(10) as integer dim printstr as strin
2012-05-10 08:28:23
287
原创 任意前n个数求和
private function sum(n as integer) as integer if n sum=n+sum(n-1) else sum=1 end if private sub command1-click() print sum(2) end sub
2012-05-10 08:04:46
1623
原创 提取最值与中介值
我记得老师的过程好像是这个: dim m as integerdim a(9) as integer print str(ubound(a)) print str ( ( ubound(a)-lbound(a)+1 ) \ 2 ) dim larray() as integerredim larray(0 to m) redim rarry(0 to ub
2012-05-05 11:27:16
339
原创 运用递归思想求100以内整数的和
上节课老师讲了用递归思想求100以内整数的和,主要内容如下: private sub command1-click() print str(f(100)) end sub function f(n as integer) as integer if n=1 then f=1 else f=n+f(n-1) end if
2012-05-05 10:42:51
682
原创 10位数程序实现输出最大值
好不容易上个网,就允许我多写几篇吧! 这次是建了个command,点击写的。 Dim max as integer Dim mystr as string mystr = " " for i = 0 to 9mystr = mystr + " "+ str(f(i))' print str(f(i))Next i print mystr max
2012-04-26 09:41:32
329
原创 比较三位数大小,输出最大的一个
主要内容应该是: Dim a As integer Dim b As integer Dim c As integer If a>=b then max =a else max =bEnd if if c>=max then max =cEnd ifPrint max心得体
2012-04-26 09:29:53
793
原创 求100以内的素数的和
Private Sub Command1-click() Dim i as integer Dim s as integer s=0For i=2 to 100if sushu(i) then s=s+iNext iPrint sEnd SubFunction sushu (n as integer) as boolean D
2012-04-26 09:18:53
515
2
原创 比较两位数的大小
比较两位数的大小,主要步骤: Dim m as integer Dim n as integer if m>=n then print m else print n end if 心得体会:有 if 的时候别忘了写 end if 。
2012-04-26 09:08:50
333
原创 计算机VB作业
计算机实验报告 专业:11级教育学 班级:一班 姓名:耿学会 学号:11110141003 日期:2011.3.21 实验一:显示各位数一、实验目的:充分认识计算机vb语言及其能够处理的数据类型。
2012-04-05 10:11:55
613
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人