VB.Net/Language Basics/Oct

Материал из VB Эксперт
Версия от 15:42, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Data type: Long, Char, Hex and Oct

<source lang="vbnet"> 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

      </source>