Giter Site home page Giter Site logo

Comments (13)

AltureT avatar AltureT commented on June 27, 2024

关于github账号注册,同学们可以百度搜索:github注册

from lifenote.

wbenteng avatar wbenteng commented on June 27, 2024

题目一的另一种解法倪

from lifenote.

AltureT avatar AltureT commented on June 27, 2024

@wbenteng
题目一的另一种解法倪

等你在评论里写出来,哈哈

from lifenote.

wbenteng avatar wbenteng commented on June 27, 2024

这。。。我写写看,有点忘了

from lifenote.

wbenteng avatar wbenteng commented on June 27, 2024

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.

AltureT avatar AltureT commented on June 27, 2024

@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

排序代码没错,可是你有两个小问题:

  1. 你定义的是数组变量a,写法应该是a(1),而不是a1
  2. 输出这里
Label1.Caption = Str(a1) + "" + Str(a2) + "" + Str(a3)

a1改成a(1),然后你加了一个""字符串,不是相当于没加吗.
不过str函数默认会在前面加一个空格的

from lifenote.

wbenteng avatar wbenteng commented on June 27, 2024

那你答案的输出语句的“”“”也可以去掉哩

from lifenote.

AltureT avatar AltureT commented on June 27, 2024

@wbenteng
那你答案的输出语句的“”“”也可以去掉哩

恩,是的,可是我写出来是一种提示作用,有些学生可能不清楚str用完后会自动在前面加一个空格

from lifenote.

wbenteng avatar wbenteng commented on June 27, 2024

第二题的sum用integer会不会溢出呀

from lifenote.

AltureT avatar AltureT commented on June 27, 2024

@wbenteng
第二题的sum用integer会不会溢出呀

你说的对,我只限制了单个数,两数加起来就超过integer范围了,我稍后修改

from lifenote.

AltureT avatar AltureT commented on June 27, 2024

@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.

AltureT avatar AltureT commented on June 27, 2024

写完后可以点击预览观察效果,格式如下图:
添加代码

from lifenote.

LuisGarrettLyu avatar LuisGarrettLyu commented on June 27, 2024

你好,黄老师
网站做的真不错!继续努力!
祝顺利

from lifenote.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.