扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
int ival = 0; Int32 ival2 = 0; |
基本类型 | System命名空间中对应的类 | 注释/用法 |
bool | System::Boolean | bool dirty = false; |
char | System::SByte | char sp = ' '; |
signed char | System::SByte | signed char ch = -1; |
unsigned char | System::Byte | unsigned char ch = '\0'; |
wchar_t | System::Char | wchar_t wch = ch; |
short | System::Int16 | short s = ch; |
unsigned short | System::UInt16 | unsigned short s = 0xffff; |
int | System::Int32 | int ival = s; |
unsigned int | System::UInt32 | unsigned int ui = 0xffffffff; |
long | System::Int32 | long lval = ival; |
unsigned long | System::UInt32 | unsigned long ul = ui; |
long long | System::Int64 | long long etime = ui; |
unsigned long long | System::UInt64 | unsigned long long mtime = etime; |
float | System::Single | float f = 3.14f; |
double | System::Double | double d = 3.14159; |
long double | System::Double | long double d = 3.14159L; |
int imaxval = int::MaxValue; int iminval = Int32::MinValue; |
String^ bonus = "$ 12,000.79"; |
double myBonus = double::Parse( bonus, ns ); |
using namespace System; using namespace System::Globalization; double bonusString( String^ bonus ) { NumberStyles ns = NumberStyles::AllowLeadingWhite; ns |= NumberStyles::AllowCurrencySymbol; ns |= NumberStyles::AllowThousands; ns |= NumberStyles::AllowDecimalPoint; return double::Parse( bonus, ns ); } |
int ival = ( int ) myBonus; |
int ival2 = Convert::ToInt32( myBonus ); |
Console::Write( "{0} : ", ( 5 ).ToString() ); |
Console::WriteLine(( 'a' ).ToString() ); |
Console::WriteLine(((wchar_t)'a').ToString() ); |
public ref class R { public: void foo( System::String^ ); // (1) void foo( std::string ); // (2) void foo( const char* ); // (3) }; void bar( R^ r ) { // 调用哪一个foo呢? r->foo( "Pooh" ); } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者