. VB.NET VB6 VBScript, Format, Format Number, FormatCurrency, FormatPercent FormatDateTime. , , .NET Framework.
.NET Framework . :
Dim balance As Decimal = 123456
Dim creditLimit As Decimal = 999999
Console.WriteLine ("Customer balance is {0:C}, credit limit is {1:C} ",_
balance. creditLimit = balance)
:
Customer balance is $123,456.00. credit limit is $876.543.00
, , :
Console.WriteLine ("Customer credit is {1:C}, balance is {0:C} ".
balance. creditLimit = balance)
:
Customer credit is $876.543.00. balance is $123.456.00
. , {1:} , {0:} (, .NET Framework 0). ѻ , Windows.
. 4.7 .
(/) Double, . (\) Integer. , Decimal Integer .
4.7.
+ | |
- | ( ) |
/ | ( Double DivideByZero;) |
\ | ( DivideByZero) |
* | |
Math.Pow(x,y) | x y |
, .NET GetType. ( WriteLine) . :
Module Modulel
Sub Main()
Console.WriteLine((4 / 2).GetType())
Console. ReadLine()
End Sub
End Module
System.Double
GetType , .
, , . ( ) , . @, Decimal:
|
|
Option Strict On
Module Modulel
Sub Main()
Dim cdeg As Decimal
Console.Write( Enter the degrees in centigrade...")
cdeg=CDec(Console.ReadLine())
Dim fdeg As Decimal
fdeg = (((9 / 5) * cdeg) + 32)
Console.WriteLine(cdeg & " is " & fdeg & " degrees Fahrenheit.")
Console. ReadLine()
End Sub
End Module
- / fdeg Double. , :
Option Strict disallows implicit conversions from Double to Decimal.
? Option Strict VB.NET, . @ ( ) Decimal. :
fdeg = ((CDec(9 / 5) * cdeg) + 32)
Decimal, Decimal.
, Write WriteLine, . , , .
, VB.NET IEEE, . :
Sub Main()
Dim getData As String
Dim x, As Double
x = 4
= 0
Console.WriteLine("What is 4/0 in VB.NET? " & x / y)
Console.ReadLine()
End Sub
:
What is 4/0 in VB. NET? Infinity
0/0
NaN (Not A Number, ).
. 4.8 , Integer Long.
4.8.
\
Mod
\ Integer ( ). , 7\3=21. , / Double; , Integer \ .
Mod . , 7 Mod 3 = 1. , Mod 0: 8 Mod 4 = 0.
. . VB.NET, , , . , ; , 3+4*5 23, (4*5) , .
|
|
.
(^).
( ).
.
.
(Mod).
.
, ( ).
, , VB. NET , .
*= = *
+= = +
/= = /
-= = -
\= = \
^= = ^
&= = & ( )