Presentation is loading. Please wait.

Presentation is loading. Please wait.

網頁設計第十二課.

Similar presentations


Presentation on theme: "網頁設計第十二課."— Presentation transcript:

1 網頁設計第十二課

2 Visual Basic 語言簡介 一 資料與運算 比較運算 >, >=, <, <=, =
比較運算 >, >=, <, <=, = 串接運算 First = “Peter” Last = “Wang” Print First+ “ “ + Last 邏輯運算 Not, And, Or 綜合運算 +, -, *, /, mod 優先順序:算術 > 字串 > 比較>邏輯

3 二 變數: 需宣告 (例如以下例) Dim i as integer Dim x as float Dim y as double Dim dd as date Dim s1 as string Dim s2 as string*80 Dim A(10,15) as Integer const pi = Variant 不限型態

4 三 控制敘述 有條件執行的IF (1) If ( ) Then . End If (2) If-Then-Else

5 (3) Nested If If ( ) Then . ElseIf Else End If

6 (4) Select Dim id as integer Select case id case 1: . case else End Select

7 四 迴圈 Loop (i) For ….. Next For I=1 To 10 Print I Next I (ii) Do loop I=1 Do while I <=10 I=I+1 Loop

8 五 迴圈 Loop (iii) While-Wend迴圈 I=1 While I <=10 Print I I=I+1 Wend

9 五. 陣列 (1) 一維陣列: Dim 陣列名稱(N) As 資料型別 Dim y(10) as integer y=100 For I=0 to 10 y(I) = 100 Next I (2) 多維陣列 Dim 陣列名稱(L,M,N,…) As 資料型別

10 六 訊息與輸入窗 輸出窗 x = MsgBox “你好嗎” 輸入窗 x = InputBox (“請輸入身高”) A = InputBox (“請輸入A值”) B = InputBox (“請輸入B值”) C = A + B

11

12

13

14

15

16

17

18 第十二課習題 請利用ASP例題,作下列習題: 體重為65公斤 真不錯,標準體重喔! 起跳 70元 續跳 5元
第一題:(本題請用Select Case 作)依照Weight變數值之不同,回覆不同評語,評語如下: 1. Weight 低於50: “你是難民嗎?“ 2. Weight 介於50~59: "快點增肥吧!“ 3. Weight 介於60~69: "真不錯,標準體重喔!“ 4. Weight 介於70~79: "該減肥了!“ 5. Weight 在80以上: "小心健康!!“ 第二題:設計計算計程車費的程式,計算公式如下: 體重為65公斤 真不錯,標準體重喔! 起跳 1500公尺 70元 續跳 300公尺 5元 里程:1.85公里 日間計費 總價80元

19 第三題:博碩公司“網頁設計”一書定價500元,但有折扣,方式如下: 1 ~ 本書 不打折; 6 ~ 本書照定價打9折; 11 ~ 本書照定價打8.5折;31 ~ 50本書 照定價打8折; 51 本以上本書照定價打7折。 請設計一程式輸入訂書量就能計算出總售價。(用 Select Case 作) 第四題:列出1~100中不能被5整除的數(提示:用mod函數) If II Mod 5 = 0 Then Response.write "<td>" & II & "</td>“ 第五題: 請作出九九乘法表 第六題:利用迴圈計算 ‧‧‧+ n2的值,n=10


Download ppt "網頁設計第十二課."

Similar presentations


Ads by Google