Anonymous
Anonymous asked in 電腦與網際網路程式設計 · 1 decade ago

VB新手的一些問題

這是我第一次接觸VB(可以這麼說)

以下是我,在VB參考書裡面的練習題

Dim lastName As Char = "張", middleName As String = "David"

Console.WriteLine(middleName + lastName + "您好!")

請問一下唷

第一行As Char = "張" 為什麼要用Char阿= =那幹嗎用的

下一句的As String 。String又是幹嗎用的= =?

我知道Char是字元變數 String是字串變數

各有什麼功能呢?

Update:

console又是什意思

2 Answers

Rating
  • x32768
    Lv 5
    1 decade ago
    Favorite Answer

    Char '''''''單一字元

    String '''''''''多個字元

    Char a = "abcd" '''''''''''''執行錯誤(溢位)

    String b = "張" '''''''''''可正常執行

    Console.WriteLine(middleName lastName "您好!") ''''''將字串印出

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Functionality

    The Console class contains methods that read individual characters or entire lines from the console; and several write methods that automatically convert an instance of a value type, an array of characters, or sets of objects to a formatted or unformatted string, and then writes that string, optionally followed by a line termination string, to the console. The Console class also contains methods and properties to get or set the size of the screen buffer, console window, and cursor; to change the position of the console window and cursor; to move or clear data in the screen buffer; to change foreground and background colors; to change the text displayed in the console title bar; and to play the sound of a beep.

    Source(s): MSDN
  • 這應該是VB.NET 的程式碼

    CHAR 代表一個字元,例如 A~Z,0~9都各字代表一個字元

    String 是字串 例如 "我愛大奶妹" 就是一串『文字』

    Console 是指在 命令提示字元下的動作

    Console.WriteLine(middleName + lastName + "您好!")

    代表 在命令提示字元下輸出 David張你好

Still have questions? Get your answers by asking now.