1.主控台應用程式用到的輸出方法有:
Console.WriteLine Console.Write
2. 主控台應用程式用到的輸入方法有:
Console.Read Console.ReadLine
3. 寫出 VB 運算子的優先順序(由上到下代表高到低)
1.
( )
2.
^
3.
+(正號) -(負號)
4.
*/
5.
\
6.
Mod
7.
+ -
8.
&
9.
=、<>、<、>、<=、>=、Like、Is、IsNot、TypeOf…If…
10.
Not
11.
And
12.
AndAlso
13.
Or、 OrElse
14.
Xor
15.
=, ^=, *=, /=, \=, +=, -=
4. 只用一條程式碼,印出上機練習題 1 的結果。(字串串接及程式碼換行排版練習)
Console.WriteLine("====Console.WriteLine練習====")
Console.WriteLine(" 班級: 資應一甲")
Console.WriteLine(" 學號:1110534023")
Console.WriteLine(" 姓名:李侑庭")
5. 不恰當的資料型態宣告,會影響到結果的正確性。請參考 [ch02.資料的基本概念投影片]
pp. 15-16 試寫一程式來印出各數值型別之表示範圍,並和課本比較是否有異。
6. 請各位寫一個文字模式的程式,導引使用者輸入數值 x,數值 y,展示此二數的各項算
術運算 ^ * / \ mod + - 結果(專案檔名: ch03-ConsoleIO-xxxxxxx)
Dim x, y As Single
'導引使用者輸入數值 x,數值 y
Console.WriteLine("===數值的算術運算===")
Console.Write("x=")
x = Console.ReadLine
Console.Write("y=")
y = Console.ReadLine
'展示此二數的各項算術運算 ^ * / \ mod + - 結果
Console.WriteLine(x & "^" & y & "=" & x ^ y)
Console.WriteLine(x & "*" & y & "=" & x * y)
Console.WriteLine(x & "/" & y & "=" & x / y)
Console.WriteLine(x & "\" & y & "=" & x \ y)
Console.WriteLine(x & "mod" & y & "=" & x Mod y)
Console.WriteLine(x & "+" & y & "=" & x + y)
Console.WriteLine(x & "-" & y & "=" & x - y)
7. 輸入半徑 r , 印出此圓之「圓周長」及「圓面積」。
(專案檔名: ch03-ConsoleCircle-xxxxxxx-prj, 請用常數來定義圓周率 pi=3.14159265)
Dim r As Double
Dim pi As Double = (3.14159265)
'輸入半徑 r , 印出此圓之「圓周長」及「圓面積」
Console.WriteLine("輸入半徑 r , 印出此圓之「圓周長」及「圓面積」")
Console.Write("r=")
r = Console.ReadLine
Console.WriteLine("圓周長" & "=" & r * 2 * pi)
Console.Write("圓面積" & "=" & r * r * pi)