【文章內(nèi)容簡(jiǎn)介】
If x 110 Then y = * xElse If x = 210 Then y = * 110 + * (x 110) Else y = * 110 + * 100 + * (x 210) End IfEnd IfPrint 電費(fèi)。 y方法二:(左邊嵌分支)Dim x As Singlex = InputBox(輸入用電)If x = 110 Then If x 210 Then y = * 110 + * 100 + * (x 210) Else y = * 110 + * (x 110) End IfElse y = * xEnd IfPrint 電費(fèi)。 y代碼:Dim a As IntegerDim b As Integera = InputBox(輸入站數(shù))b = InputBox(輸入人數(shù))If a = 4 Then m = 3 * bElse If a = 9 Then m = 4 * b Else m = 5 * b End IfEnd IfPrint 應(yīng)付款。 m練習(xí)5:購(gòu)買(mǎi)地鐵車(chē)票:乘14站3元/位,59站4元/位,9站以上5元/位,輸入站數(shù)和人數(shù),輸出應(yīng)付款。練習(xí)6:長(zhǎng)江遂橋貨車(chē)通行費(fèi)收費(fèi)標(biāo)準(zhǔn)(載重用w表示,收費(fèi)用m表示)Dim w As Singlew = InputBox(輸入載重)If w = 2 Thenm = 60End IfIf w 2 And w = 5 Thenm = 95End IfIf w 5 And w = 10 Thenm = 105End IfIf w 10 And w = 15 Thenm = 130End IfIf w 15 Thenm = 145End IfPrint 應(yīng)付款,