aliases for primitive data types are provided in the C + +/CLI extensions, which are identical to the built-in data type names provided in C + +.
The primary primitive data types provided are the following aliases (C + +/CLI types):
Primitive data types |
C + +/CLI type |
Description |
Boolean |
bool |
Boolean type |
Byte |
Char |
8-bit unsigned integer |
SByte |
Signed Char |
8-bit signed integer |
Char |
__wchar_t |
16-bit Unicode character type |
Int16 |
Short |
16-bit signed integer |
UInt16 |
unsigned short |
16-bit unsigned integer |
Int32 |
int or Long |
32-bit signed integer |
UInt32 |
unsigned int long |
32-bit signed integer |
Int64 |
__int64 |
64-bit signed integer |
UInt64 |
unsigned __int64 |
64-bit signed integer |
Single |
Float |
32-bit single-precision floating-point number |
Double |
Double |
64-bit double-precision floating-point number |
Decimal |
Decimal |
96-bit signed integer |
Object |
object^ |
Class object reference |
String |
string^ |
Unicode String Reference |
Mathematical Functions
Although the C + + system library functions can still be used in a CLI program. For example, use mathematical functions by including math.h. However , in a managed program, you should
Replace the system library functions that use C + + with the large number of type and type methods provided by the FCL . The math functions most frequently used by programs are in the FCL by the math type
The static properties of the type provided by the method e and pi provide the user with the usual mathematical constants e and π; the static member function of this type provides users with common mathematical functions such as
Under
Absolute value function:Abs
exponential function: Exp
Trigonometric functions: Sin Cos Tan
Hyperbolic trigonometric functions:Sinh Cosh Tanh
Inverse trigonometric function: Asin Acos Atan Atan2
Logarithmic function: log Log10
Square function: Pow
Radical function: Sqrt
To find a larger number function:Max
To ask for a smaller number of functions:Min
Rounding function:Round
Rounding function: Floor
Note the use of these static properties and methods must be prefixed with the class name math and the domain operator :: , for example, math::P i,math::sqrt (25.0) , and so on. Casts can pass
The method implementation provided by the Convert type defined in the System namespace. For example, to cast a variable value of type Int32 to
int number;
__int64 Longnumber =convert::toint64 (number);
Note that the cast allows for non-compliance with the principle of data length promotion.
C + +/CLI basic data type and function "3"