Comments (13)
关于github账号注册,同学们可以百度搜索:github注册
from lifenote.
题目一的另一种解法倪
from lifenote.
@wbenteng
题目一的另一种解法倪
等你在评论里写出来,哈哈
from lifenote.
这。。。我写写看,有点忘了
from lifenote.
Private Sub Command1_Click()
Dim a(1 To 3) As Integer
a1 = Val(Text1.Text): a2 = Val(Text2.Text): a3 = Val(Text3.Text)
For i = 1 To 2
For j = i + 1 To 3
If a(i) > a(j) Then
t = a(i): a(i) = a(j): a(j) = t
End If
Next j
Next i
Label1.Caption = Str(a1) + "" + Str(a2) + "" + Str(a3)
End Sub
from lifenote.
@wbenteng
Private Sub Command1_Click()
Dim a(1 To 3) As Integer
a1 = Val(Text1.Text): a2 = Val(Text2.Text): a3 = Val(Text3.Text)
For i = 1 To 2
For j = i + 1 To 3
If a(i) > a(j) Then
t = a(i): a(i) = a(j): a(j) = t
End If
Next j
Next i
Label1.Caption = Str(a1) + "" + Str(a2) + "" + Str(a3)End Sub
排序代码没错,可是你有两个小问题:
- 你定义的是数组变量a,写法应该是a(1),而不是a1
- 输出这里
Label1.Caption = Str(a1) + "" + Str(a2) + "" + Str(a3)
a1改成a(1),然后你加了一个""字符串,不是相当于没加吗.
不过str函数默认会在前面加一个空格的
from lifenote.
那你答案的输出语句的“”“”也可以去掉哩
from lifenote.
@wbenteng
那你答案的输出语句的“”“”也可以去掉哩
恩,是的,可是我写出来是一种提示作用,有些学生可能不清楚str用完后会自动在前面加一个空格
from lifenote.
第二题的sum用integer会不会溢出呀
from lifenote.
@wbenteng
第二题的sum用integer会不会溢出呀
你说的对,我只限制了单个数,两数加起来就超过integer范围了,我稍后修改
from lifenote.
@yichengsjw123
题目七的另一种解法
Dim a , b , c as Integer
Dim s as Integer
a=Val (text1.text)
b=Val (text2.text)
c=Val (text3.text)
If a>b then t=a:a=b:b=t
If a>c then t=a:a=c:c=t
If b>c then t=b:b=c:c=t
s=b+c
Lable1.caption= Str( s)
很不错的思路,先将3个数字从小到大排序,然后将最大的两个相加。
另外提醒一点,我们在评论中添加代码,可以代码上方加入(双引号里面的部分)“ ```vb ”,下方加入“ ``` ”,让我们的代码更加美观:
Dim a , b , c as Integer
Dim s as Integer
a=Val (text1.text)
b=Val (text2.text)
c=Val (text3.text)
If a>b then t=a:a=b:b=t
If a>c then t=a:a=c:c=t
If b>c then t=b:b=c:c=t
s=b+c
Lable1.caption= Str(s)
from lifenote.
from lifenote.
你好,黄老师
网站做的真不错!继续努力!
祝顺利
from lifenote.
Related Issues (20)
- Visual Basic程序设计61-70(题目已完成) | 罗中算法练习
- Visual Basic程序设计51-60(题目已完成) | 罗中算法练习
- Visual Basic程序设计1-10 | 罗中算法练习
- Visual Basic程序设计31-40 | 罗中算法练习
- Visual Basic程序设计11-20 | 罗中算法练习
- Visual Basic程序设计21-30 | 罗中算法练习
- Visual Basic程序设计41-50 | 罗中算法练习
- Visual Basic程序设计1-10 | 罗中算法练习 HOT 1
- Visual Basic程序设计11-20 | 罗中算法练习
- Visual Basic程序设计51-60(题目已完成) | 罗中算法练习
- Visual Basic程序设计91-100(题目已完成) | 罗中算法练习
- Visual Basic程序设计41-50 | 罗中算法练习
- Visual Basic程序设计31-40 | 罗中算法练习
- Visual Basic程序设计71-80(题目已完成) | 罗中算法练习
- Visual Basic程序设计21-30 | 罗中算法练习
- Visual Basic程序设计31-40(题目已完成) | 罗中算法练习 HOT 1
- | 罗中算法练习
- Visual Basic程序设计81-90(题目已完成) | 罗中算法练习
- Visual Basic程序设计91-100(题目已完成) | 罗中算法练习
- Visual Basic程序设计71-80(题目已完成) | 罗中算法练习
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lifenote.