C++数据类型:原始类型(整型 int、浮点型 float、布尔型 bool、字符型 char/wchar_t) 复合类型(数组 array、指针 pointer、引用 reference) 自定义类型(结构 struct、联合 union、枚举 enum、类class)。
关键字:short /int/long/unsigned/float/double/long double/bool/char/
wchar_t/int m[ ]/int * ip
结构:
struct POINT
{
double x;
double y;
};
POINT p={100,200};
输出:p.x=100; p.y=200;
联合:
struct RGB
{
unsigned char blue;
unsigned char green;
unsigned char red;
};
union COLOR
{
unsigned int value;
RGB rgb;
};
COLOR c={0xFF8844};
cout<<hex<<(int)c.rgb.red<<","<<(int)c.rgb.green<<","<<(int)c.rgb.blue<<endl;
输出:ff,88,44
枚举:
enum WEEKDAY
{
Sunday=0,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
};
WEEKDDAY today= Monday;
cout<<"today is "<<today<<endl;
输出:today is 1
①_intN类型
_int8/_int16/_int32/_int64 代表 N/8个字节,即:1,2,4,8个字节
②<climits>
整数的最值头文件
③<cctype>
判断字符的类别,如:数字、字母等。
2.<cstring>
完成字符串的追加、复制与比较等操作。
std::string ATL::CString
3.<ctime>
时间操作函数
ATL::CTime ATL::CTimeSpan ATL::COleDateTime ATL::COleDateTimeSpan
4.智能指针(smart pointer)
std::auto_ptr
ATL::CComPtr ATL::CComQIPtr
5.位置与尺寸
6.Windows数据类型
7.MFC对象模型