電腦硬體可不斷循環運動,例如汽車旋轉車輪前行,但是要指揮左右轉彎,加個軚盤,要有指令(左邊拐彎,再直行百米右邊拐彎,再停下來再後退三米,)電腦程式設計也就是指令,命令不斷循環運動中的機器,如何達到泊車位目的。
電腦程式設計:CarParking
Public Class Form1
Dim number As Integer = 0
Dim sampleString As String
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Evaluate number and branch to appropriate label.
If number = 100 Then GoTo LastLine Else GoTo Line2
Line1:
sampleString = "Number equals 100"
TextBox1.Text = sampleString
Line2:
' The following statement never gets executed because number under = 100.
number = number + 10
sampleString = "Number equals " & number.ToString & " M"
TextBox1.Text = sampleString
Exit Sub
LastLine:
Beep()
End Sub
End Class
Public Class Form1
Dim number As Integer = 0
Dim sampleString As String
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Evaluate number and branch to appropriate label.
If number = 100 Then GoTo LastLine Else GoTo Line2
Line1:
sampleString = "Number equals 100"
TextBox1.Text = sampleString
Line2:
' The following statement never gets executed because number under = 100.
number = number + 10
sampleString = "Number equals " & number.ToString & " M"
TextBox1.Text = sampleString
Exit Sub
LastLine:
Beep()
End Sub
End Class
請下載:
Visual Studio Community 2019 (version 16.11)
https://my.visualstudio.com/Downloads?q=visual%20studio%202019&wt.mc_id=o~msft~vscom~older-download
安裝之後啟動範例:如何第一次執行電腦程式設計
https://www.vbtutor.net/vb2019/vb2019_lesson1.html
以下網際網路為下載近執行檔範例:因免費使用雲端沒辦法驗證,請關閉視窗安全性設定之「即時保護」和選擇「仍要下載」和「保留」即可。
https://drive.google.com/file/d/12lX0zx3IF9BBxPnqqWfHRZxGcrz9XO3v/view?usp=sharing
請撥冗光臨《Blogger - 快樂和尚家僧-Cheerful-HomeMonk【人在做、天在看、車在震】 》
http://cheerfulhomemonk.blogspot.hk/2017/04/blog-post_25.html
星期二 2017年四月25日 下午 07:55:12
創作日期:星期四 2022年六月2日 下午 06:48:38

沒有留言:
張貼留言