1 / 19

網頁設計第十二課

網頁設計第十二課. Visual Basic 語言簡介. 一 資 料與運算 比較運算 >, >=, <, <=, = 串接運算 First = “Peter” Last = “Wang” Print First+ “ “ + Last 邏輯運算 Not, And, Or 綜合運算 +, -, *, /, mod 優先順序 : 算術 > 字串 > 比較 > 邏輯. 二 變數 : 需宣告 ( 例如以下例 ) Dim i as integer

traci
Download Presentation

網頁設計第十二課

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 = 3.141593 Variant 不限型態

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

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

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

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

More Related