看見公告的同學,請傳達以下各班的學藝股長,請拿作業抽查表,給計概老師。謝謝您!
汽車1、綜高1忠、AND某班已經簽過作業抽查表的班級。
因為同學去問了教務處,答覆:本次作業抽查,不含計概。必需更正作業抽查表的簽名。
附註:各位同學,請按時繳交作業:
期末報告一
期末報告二
謝謝各位同學
抽查同學:
04、13、16、22、28、34
2019年5月28日 星期二
Bread麵包配方--程式碼示範
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim percentage, Baking As Single
TextBox17.Text = Val(TextBox1.Text) + Val(TextBox2.Text) + Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text) + Val(TextBox7.Text)
Baking = ((Val(TextBox15.Text) * Val(TextBox16.Text)) / Val(TextBox17.Text)) / 0.95
TextBox18.Text = Baking
TextBox8.Text = Int(Val(TextBox1.Text) * Baking)
TextBox9.Text = Int(Val(TextBox2.Text) * Baking)
TextBox10.Text = Int(Val(TextBox3.Text) * Baking)
TextBox11.Text = Int(Val(TextBox4.Text) * Baking)
TextBox12.Text = Int(Val(TextBox5.Text) * Baking)
TextBox13.Text = Int(Val(TextBox6.Text) * Baking)
TextBox14.Text = Int(Val(TextBox7.Text) * Baking)
End Sub
End Class
扶養比--程式碼示範
Public Class Form1
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
Call Raise()
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
Call Raise()
End Sub
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
Call Raise()
End Sub
Sub Raise()
Dim Raise As Single
Dim r, g, b As Integer
If Val(TextBox2.Text) <> 0 Then
Raise = (Val(TextBox1.Text) + Val(TextBox3.Text)) / Val(TextBox2.Text)
Label6.Text = Raise * 100 & "%"
REM
r = Int(Raise * 2 * 255)
If r > 255 Then
r = 255
ElseIf r < 0 Then
r = 0
End If
g = Int(255 / (Raise * 10))
If g > 255 Then
g = 255
ElseIf r < 0 Then
g = 0
End If
End If
PictureBox1.BackColor = Color.FromArgb(r, g, 0)
End Sub
End Class
2019年5月27日 星期一
猜猜鴨特徵--程式碼示範
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = "北京鴨" Then
If CheckBox2.Checked And CheckBox3.Checked And Not CheckBox1.Checked And Not CheckBox4.Checked Then
Label2.Text = "答對了"
Else
Label2.Text = " 答錯了"
End If
End If
End Sub
End Class
物種分類--程式碼示範
Public Class Form1
Dim head, wing, foot As Integer
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("w.jpg")
Me.PictureBox1.Image = Image.FromStream(fs)
head = 1
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("b.jpg")
Me.PictureBox1.Image = Image.FromStream(fs)
head = 2
End Sub
Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton3.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("wb.jpg")
Me.PictureBox1.Image = Image.FromStream(fs)
head = 3
End Sub
Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton4.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("g.jpg")
Me.PictureBox1.Image = Image.FromStream(fs)
head = 4
End Sub
Private Sub RadioButton5_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton5.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("y.jpg")
Me.PictureBox1.Image = Image.FromStream(fs)
head = 5
End Sub
Private Sub RadioButton6_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton6.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("h1.jpg")
Me.PictureBox2.Image = Image.FromStream(fs)
wing = 1
End Sub
Private Sub RadioButton7_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton7.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("h2.jpg")
Me.PictureBox2.Image = Image.FromStream(fs)
wing = 2
End Sub
Private Sub RadioButton8_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton8.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("h3.jpg")
Me.PictureBox2.Image = Image.FromStream(fs)
wing = 3
End Sub
Private Sub RadioButton9_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton9.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("h4.jpg")
Me.PictureBox2.Image = Image.FromStream(fs)
wing = 4
End Sub
Private Sub RadioButton10_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton10.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("h5.jpg")
Me.PictureBox2.Image = Image.FromStream(fs)
wing = 5
End Sub
Private Sub RadioButton11_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton11.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("f1.jpg")
Me.PictureBox3.Image = Image.FromStream(fs)
foot = 1
End Sub
Private Sub RadioButton12_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton12.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("f2.jpg")
Me.PictureBox3.Image = Image.FromStream(fs)
foot = 2
End Sub
Private Sub RadioButton13_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton13.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("f3.jpg")
Me.PictureBox3.Image = Image.FromStream(fs)
foot = 3
End Sub
Private Sub RadioButton14_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton14.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("f4.jpg")
Me.PictureBox3.Image = Image.FromStream(fs)
foot = 4
End Sub
Private Sub RadioButton15_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton15.CheckedChanged
Dim fs As System.IO.FileStream = System.IO.File.OpenRead("f5.jpg")
Me.PictureBox3.Image = Image.FromStream(fs)
foot = 5
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
Select Case head
Case 1
Select Case wing
Case 1
Select Case foot
Case 1
Label2.Text = "111"
Case 2
Label2.Text = "112"
Case 3
Label2.Text = "113"
Case 4
Label2.Text = "114"
Case 5
Label2.Text = "115"
End Select
Case 2
Select Case foot
Case 1
Label2.Text = "121"
Case 2
Label2.Text = "122"
Case 3
Label2.Text = "123"
Case 4
Label2.Text = "124"
Case 5
Label2.Text = "125"
End Select
Case 3
Select Case foot
Case 1
Label2.Text = "131"
Case 2
Label2.Text = "132"
Case 3
Label2.Text = "133"
Case 4
Label2.Text = "134"
Case 5
Label2.Text = "135"
End Select
Case 4
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 5
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
End Select
Case 2
Select Case wing
Case 1
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 2
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 3
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 4
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 5
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
End Select
Case 3
Select Case wing
Case 1
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 2
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 3
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 4
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 5
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
End Select
Case 4
Select Case wing
Case 1
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 2
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 3
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 4
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 5
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
End Select
Case 5
Select Case wing
Case 1
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 2
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 3
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 4
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
Case 5
Select Case foot
Case 1
Case 2
Case 3
Case 4
Case 5
End Select
End Select
End Select
End Sub
End Class
原子序--程式碼示範
Public Class Form1
Dim atomic As Integer
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
atomic = Val(TextBox1.Text)
Select Case atomic
Case 1
Label1.Text = "H"
label2.text = "氫"
Case 2
Label1.Text = "He"
Label2.Text = "氦"
Case 3
Label1.Text = "LI"
Label2.Text = "鋰"
Case 4
Label1.Text = "Be"
Label2.Text = "鈹"
Case 5
Label1.Text = "B"
Label2.Text = "硼"
End Select
End Sub
Private Sub Button1_MouseMove(sender As Object, e As MouseEventArgs) Handles Button1.MouseMove
TextBox1.Text = "1"
Label1.Text = "H"
Label2.Text = "氫"
End Sub
Private Sub Button5_MouseMove(sender As Object, e As MouseEventArgs) Handles Button5.MouseMove
TextBox1.Text = "2"
Label1.Text = "He"
Label2.Text = "氦"
End Sub
Private Sub Button2_MouseMove(sender As Object, e As MouseEventArgs) Handles Button2.MouseMove
TextBox1.Text = "3"
Label1.Text = "Li"
Label2.Text = "鋰"
End Sub
Private Sub Button3_MouseMove(sender As Object, e As MouseEventArgs) Handles Button3.MouseMove
TextBox1.Text = "4"
Label1.Text = "Be"
Label2.Text = "鈹"
End Sub
Private Sub Button4_MouseMove(sender As Object, e As MouseEventArgs) Handles Button4.MouseMove
TextBox1.Text = "5"
Label1.Text = "B"
Label2.Text = "硼"
End Sub
End Class
2019年5月26日 星期日
第1次、第2次期末報告
第1次期末報告
請用VB製作一個PC版的專題,上台報告。
範例如:
https://howtodoing.blogspot.com/2019/05/2a1b.html
https://howtodoing.blogspot.com/2016/11/blog-post.html
https://howtodoing.blogspot.com/2018/06/blog-post_20.html
第2次期末報告
請用App Inventor2製作一個手機版的專題,上台報告。
範例如
https://howtodoing.blogspot.com/2017/06/blog-post.html
比照第1次期末報告,製作簡報、文件、程式碼。
第1次、第2次期末報告,可以用相同的題目。
但是簡報、文件、程式碼要重新作過。
請用VB製作一個PC版的專題,上台報告。
範例如:
https://howtodoing.blogspot.com/2019/05/2a1b.html
https://howtodoing.blogspot.com/2016/11/blog-post.html
https://howtodoing.blogspot.com/2018/06/blog-post_20.html
第2次期末報告
請用App Inventor2製作一個手機版的專題,上台報告。
範例如
https://howtodoing.blogspot.com/2017/06/blog-post.html
比照第1次期末報告,製作簡報、文件、程式碼。
第1次、第2次期末報告,可以用相同的題目。
但是簡報、文件、程式碼要重新作過。
2019年5月22日 星期三
VB2019_Color_V11
Public Class Form1
Dim R As Integer
Dim G As Integer
Dim B As Integer
Dim A As Integer
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
R = Val(InputBox("請輸入紅色", "紅", 128))
G = Val(InputBox("請輸入綠色", "綠", 128))
B = Val(InputBox("請輸入藍色", "藍", 128))
Call SetColor()
End Sub
Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
R = TrackBar1.Value
Call SetColor()
End Sub
Private Sub TrackBar2_Scroll(sender As Object, e As EventArgs) Handles TrackBar2.Scroll
G = TrackBar2.Value
Call SetColor()
End Sub
Private Sub TrackBar3_Scroll(sender As Object, e As EventArgs) Handles TrackBar3.Scroll
B = TrackBar3.Value
Call SetColor()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
R = Val(TextBox1.Text)
G = Val(TextBox2.Text)
B = Val(TextBox3.Text)
Call SetColor()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
A = MsgBox("您的色彩有" + " 紅色=" & R & " 綠色=" & G & " 藍色=" & B, MsgBoxStyle.YesNo + MsgBoxStyle.Information, "調色盤")
End Sub
Sub SetColor()
If R > 255 Then
R = 255
ElseIf R < 0 Then
R = 0
End If
If G > 255 Then
G = 255
ElseIf G < 0 Then
G = 0
End If
If B > 255 Then
B = 255
ElseIf B < 0 Then
B = 0
End If
TrackBar1.Value = R
TrackBar2.Value = G
TrackBar3.Value = B
HScrollBar1.Value = R
HScrollBar2.Value = G
HScrollBar3.Value = B
VScrollBar1.Value = R
VScrollBar2.Value = G
VScrollBar3.Value = B
Label1.Text = R
Label2.Text = G
Label3.Text = B
TextBox1.Text = R
TextBox2.Text = G
TextBox3.Text = B
PictureBox1.BackColor = Color.FromArgb(R, 0, 0)
PictureBox2.BackColor = Color.FromArgb(0, G, 0)
PictureBox3.BackColor = Color.FromArgb(0, 0, B)
PictureBox4.BackColor = Color.FromArgb(R, G, B)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
R = TrackBar1.Value
G = TrackBar2.Value
B = TrackBar3.Value
Call SetColor()
End Sub
Private Sub HScrollBar1_Scroll(sender As Object, e As ScrollEventArgs) Handles HScrollBar1.Scroll
R = HScrollBar1.Value
Call SetColor()
End Sub
Private Sub HScrollBar2_Scroll(sender As Object, e As ScrollEventArgs) Handles HScrollBar2.Scroll
G = HScrollBar2.Value
Call SetColor()
End Sub
Private Sub HScrollBar3_Scroll(sender As Object, e As ScrollEventArgs) Handles HScrollBar3.Scroll
B = HScrollBar3.Value
Call SetColor()
End Sub
Private Sub VScrollBar1_Scroll(sender As Object, e As ScrollEventArgs) Handles VScrollBar1.Scroll
R = VScrollBar1.Value
Call SetColor()
End Sub
Private Sub VScrollBar2_Scroll(sender As Object, e As ScrollEventArgs) Handles VScrollBar2.Scroll
G = VScrollBar2.Value
Call SetColor()
End Sub
Private Sub VScrollBar3_Scroll(sender As Object, e As ScrollEventArgs) Handles VScrollBar3.Scroll
B = VScrollBar3.Value
Call SetColor()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
R = TrackBar1.Value + 10
Call SetColor()
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
R = TrackBar1.Value + 1
Call SetColor()
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
R = TrackBar1.Value - 1
Call SetColor()
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
R = TrackBar1.Value - 10
Call SetColor()
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
G = TrackBar2.Value + 10
Call SetColor()
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
G = TrackBar2.Value + 1
Call SetColor()
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
G = TrackBar2.Value - 1
Call SetColor()
End Sub
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
G = TrackBar2.Value - 10
Call SetColor()
End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
B = TrackBar3.Value + 10
Call SetColor()
End Sub
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
B = TrackBar3.Value + 1
Call SetColor()
End Sub
Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
B = TrackBar3.Value - 1
Call SetColor()
End Sub
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
B = TrackBar3.Value - 10
Call SetColor()
End Sub
End Class
2019年5月10日 星期五
108課綱使用軟體
108課綱使用軟體
一、
流程圖-線上繪圖軟體
https://www.draw.io
二、
Appinventor
MIT_App_Inventor_Tools_2.3.0_win_setup.exe
安裝之后Version:2.11ai2
敬請線上更新至Version:2.52u之后的版本,謝謝您!
http://explore.appinventor.mit.edu/ai2/update-setup-software
三、
Python 3.7 version
Anaconda3-2019.03-Windows-x86_64.exe
https://www.anaconda.com/
四、
Visual Studio 2019 community
vs_community.exe
敬請全選安裝。謝謝您!
https://visualstudio.microsoft.com/zh-hant/vs/
https://visualstudio.microsoft.com/zh-hant/vs/express/
五、
LibreOffice
https://zh-tw.libreoffice.org
六、
Google Earth
https://www.google.com.tw/earth/
一、
流程圖-線上繪圖軟體
https://www.draw.io
二、
Appinventor
MIT_App_Inventor_Tools_2.3.0_win_setup.exe
安裝之后Version:2.11ai2
敬請線上更新至Version:2.52u之后的版本,謝謝您!
http://explore.appinventor.mit.edu/ai2/update-setup-software
三、
Python 3.7 version
Anaconda3-2019.03-Windows-x86_64.exe
https://www.anaconda.com/
四、
Visual Studio 2019 community
vs_community.exe
敬請全選安裝。謝謝您!
https://visualstudio.microsoft.com/zh-hant/vs/
https://visualstudio.microsoft.com/zh-hant/vs/express/
五、
LibreOffice
https://zh-tw.libreoffice.org
六、
Google Earth
https://www.google.com.tw/earth/
2019年5月6日 星期一
20190514下學期第2次段考重點整理
20190514下學期第2次段考重點整理
資料型態:
Boolean
Single
Date
Integer
Long
String
Double
運算子:
Mod
&
^
\
/
+
-
*
VB物件名稱:
TrackBar
RadioButton
Lable
TextBox
Form
Button
PictureBox
VB事件程序:
Scroll
Load
MouseMove
DoubleClick
數位邏輯閘真值表:
數位邏輯閘符號:
機器週期、指令週期:
擷取指令
解碼
提取運算元
執行
儲存
結構化程式設計:
A、每個流程都是→單向流程。
B、每個結構都是單一入口、單一出口。
一、循序結構。
1→2→3→……
二、選擇結構。
If 條件式一 Then
條件一符合時,執行本段程式
ElseIf 條件式二 Then
條件二符合時,執行本段程式
Else
以上條件都不符合時,執行本段程式
EndIf
三、重複結構。
前測While
Do While 條件
條件符合時,執行本段程式
Loop
前測Until
Do Until 條件
條件不符合時,執行本段程式
Loop
后測While
Do
執行本段程式
Loop While 條件
后測Until
Do
執行本段程式
Loop Until 條件
For X=1 to N Step
執行本段程式
Next X
資料結構:
stack 堆疊:FiLo、LiFo。
先進后出、后進先出。
(FILO, First-In-Last-Out)
(LIFO, Last-In-First-Out)
queue 佇列:FiFo、LiLo。
先進先出、后進后出。
(FIFO, First-In-First-Out)
(LILO, Last-In-Last-Out)
程式錯誤的可能:DeBug
一、語法錯誤。
二、語意錯誤。(邏輯錯誤)
三、執行階段錯誤。
參數傳遞的方法:
傳值(Call By Value):
參數以數值方式傳遞,複製一份參數值,
到被呼叫的副程式予以使用。
PS:把參數值傳到另一個記憶體位置的值。
傳址 (Call By Adress)、(Call by value of pointer):
將參數以記憶體位置的方式傳到被呼叫的副程式,
副程式需要有一個指標來指到這個參數的記憶體位置,
但call by addres本質上也是call by value,
只不過那個value剛好就是address而已。
PS:是把"記憶體位置"傳到 另一個"記憶體位置"的值
("Call By Adress")是不正統的說法,其實傳址也是傳值,
只是傳的是"記憶體位置"。
傳參考(Call By Reference):
將參數以數值的方式傳遞到被呼叫的副程式,
副程式需要有一個參考來接收這個參數。
是把記憶體位置傳到另一個記憶體位置上
(可看作同一個物件)。
PS:因為call by address的內容為指向的位置,
所以傳址的指標本身然仍然有記憶體位置。
但是傳參考是不會有的,這也是和call by address之間的差別。
資料型態:
Boolean
Single
Date
Integer
Long
String
Double
運算子:
Mod
&
^
\
/
+
-
*
VB物件名稱:
TrackBar
RadioButton
Lable
TextBox
Form
Button
PictureBox
VB事件程序:
Scroll
Load
MouseMove
MouseDown
MouseUp
ClickDoubleClick
VB物件屬性:
Text
BackColor
ForeColor
Maximum
Minmum
Value
Name
VB常見函式:
Val(Text)
MsgBox(訊息內容,按鈕+圖示,標題)
InputBox(訊息內容,標題,預設文字)
Randomize()
Color.FromArgb([A],R,G,B)
數位邏輯閘真值表:
數位邏輯閘符號:
機器週期、指令週期:
擷取指令
解碼
提取運算元
執行
儲存
結構化程式設計:
A、每個流程都是→單向流程。
B、每個結構都是單一入口、單一出口。
一、循序結構。
1→2→3→……
二、選擇結構。
If 條件式一 Then
條件一符合時,執行本段程式
ElseIf 條件式二 Then
條件二符合時,執行本段程式
Else
以上條件都不符合時,執行本段程式
EndIf
三、重複結構。
前測While
Do While 條件
條件符合時,執行本段程式
Loop
前測Until
Do Until 條件
條件不符合時,執行本段程式
Loop
后測While
Do
執行本段程式
Loop While 條件
后測Until
Do
執行本段程式
Loop Until 條件
For X=1 to N Step
執行本段程式
Next X
資料結構:
stack 堆疊:FiLo、LiFo。
先進后出、后進先出。
(FILO, First-In-Last-Out)
(LIFO, Last-In-First-Out)
queue 佇列:FiFo、LiLo。
先進先出、后進后出。
(FIFO, First-In-First-Out)
(LILO, Last-In-Last-Out)
一、語法錯誤。
二、語意錯誤。(邏輯錯誤)
三、執行階段錯誤。
參數傳遞的方法:
傳值(Call By Value):
參數以數值方式傳遞,複製一份參數值,
到被呼叫的副程式予以使用。
PS:把參數值傳到另一個記憶體位置的值。
傳址 (Call By Adress)、(Call by value of pointer):
將參數以記憶體位置的方式傳到被呼叫的副程式,
副程式需要有一個指標來指到這個參數的記憶體位置,
但call by addres本質上也是call by value,
只不過那個value剛好就是address而已。
PS:是把"記憶體位置"傳到 另一個"記憶體位置"的值
("Call By Adress")是不正統的說法,其實傳址也是傳值,
只是傳的是"記憶體位置"。
傳參考(Call By Reference):
將參數以數值的方式傳遞到被呼叫的副程式,
副程式需要有一個參考來接收這個參數。
是把記憶體位置傳到另一個記憶體位置上
(可看作同一個物件)。
PS:因為call by address的內容為指向的位置,
所以傳址的指標本身然仍然有記憶體位置。
但是傳參考是不會有的,這也是和call by address之間的差別。
2019年5月5日 星期日
期未報告的程式設計範例:2A1B
期未報告的程式設計範例:2A1B
請同學第二次段考后第二次上課,
準時繳交作業、并且上台報告。
作業包含:
1. 上台報告用的『簡報檔』。
2. 報告的『文件檔』:程式設計期末報告規範。
3. 程式的執行檔:要執行給同學看。
以上三項,請Email到:howtodoing@gmail.com
主旨:班級、組別、程式設計:題目名稱。
內文:班級、組別、程式設計:題目名稱。
組員:座號、姓名
附檔:簡報檔、文件檔、程式檔.zip
PS:上台報告才算成績,沒有上台報告,只寄檔案不計成績。
謝謝您的合作!
2A1B程式範例
2A1B執行程式
請同學第二次段考后第二次上課,
準時繳交作業、并且上台報告。
作業包含:
1. 上台報告用的『簡報檔』。
2. 報告的『文件檔』:程式設計期末報告規範。
3. 程式的執行檔:要執行給同學看。
以上三項,請Email到:howtodoing@gmail.com
主旨:班級、組別、程式設計:題目名稱。
內文:班級、組別、程式設計:題目名稱。
組員:座號、姓名
附檔:簡報檔、文件檔、程式檔.zip
PS:上台報告才算成績,沒有上台報告,只寄檔案不計成績。
謝謝您的合作!
2A1B程式範例
2A1B執行程式
2019年5月2日 星期四
九九乘法表之一
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim answer As Integer
Dim i, j As Integer
Dim KtoK As String
KtoK = ""
For i = 2 To 9 Step 1
For j = 1 To 9 Step 1
KtoK &= i & "*" & j & "=" & i * j & vbTab
Next j
KtoK &= vbNewLine
Next i
KtoK &= vbNewLine
answer = MsgBox(KtoK, MsgBoxStyle.OkOnly, "九九乘法表")
End Sub
End Class
九九乘法表
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim answer As Integer
Dim i, j, k As Integer
Dim KtoK As String
KtoK = ""
For k = 2 To 9 Step 4
For i = 1 To 9 Step 1
For j = k To k + 3 Step 1
KtoK &= j & "*" & i & "=" & i * j & vbTab
Next j
KtoK &= vbNewLine
Next i
KtoK &= vbNewLine
Next k
answer = MsgBox(KtoK, MsgBoxStyle.OkOnly, "九九乘法表")
End Sub
End Class
2019年5月1日 星期三
利息Iterest
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim answer As Integer
Dim capital, rate, money, year As Single
capital = Val(TextBox1.Text)
rate = Val(TextBox2.Text) / 100
money = Val(TextBox3.Text)
year = 0
Do
year = year + 1
capital = capital * (1 + rate)
Loop Until capital >= money
answer = MsgBox("要努力存" & year & "年,才有" & capital & "元。", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "複利")
End Sub
End Class
訂閱:
文章 (Atom)