VB.Net/Language Basics/Oct — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 16:40, 26 мая 2010

Data type: Long, Char, Hex and Oct

Imports System
Public Class MainClass
    Shared Sub Main(ByVal args As String())
        Dim num_desserts&
        Dim satisfaction_quotient#
        num_desserts = 100
        satisfaction_quotient# = 1.23
        Dim an_integer As Integer = 100
        Dim a_long As Long = 10000000000
        Dim a_double As Double = 1.0
        Dim a_boolean As Boolean = True
        Dim a_date As Date = #12/31/2007#
        Dim i As Long = 123L
        Dim ch As Char = "X"c
        Dim flags As ULong
        flags = 100 " Decimal 100.
        flags = &H64 " Hexadecimal &H64 = 6 * 16 + 4 = 96 + 4 = 100.
        flags = &O144 " Octal &O144 = 1 * 8 * 8 + 4 * 8 + 4 = 64 + 32 + 4 = 100.
        Console.WriteLine(flags)      " Decimal.
        Console.WriteLine(Hex(flags)) " Hexadecimal.
        Console.WriteLine(Oct(flags)) " Octal.
    End Sub
End Class