1 这个函数可以查看出每种类型的所占字节数和范围
#include<iostream>
#include<limits>
using namespace std;
int main()
{
cout << "int: \t\t" << "所占字节数:" << sizeof(int);
cout << "\t最大值:" << (numeric_limits<long >::max)();
}
2 1 判断一个数是不是2的几次方 if(x==x&(-x)) cout<<"yes";