Win8 x64一个程序打印出各种基本类型、几个指针类型

/*----------------------------------------------------
写一个程序打印出各种基本类型、几个指针类型和几个你所选择的枚举类型的大小。
使用 sizeof 运算符。
--------------------------------------------------------*/
#include 
#include 
using std::cout;
using std::endl;
using std::boolalpha;
int main()
{
	enum Fruits {Apple, Banana, Orange = 10, Peach,Pear};
	cout << "TYPE		" << "SIZE	" << "EXAMPLE	" << endl << endl;
	cout << "bool		" << sizeof(bool) << "	" << boolalpha << (bool)1 << endl
		 << "char		" << sizeof(char) << "	" << 'A' << endl
		 << "signed char	" << sizeof(signed char) <<  "	" << 'B' << endl
		 << "unsigned char	" << sizeof(unsigned char) << "	" << 'C' << endl
		 << "int		" << sizeof(int) <<  "	" << INT_MAX << endl
		 << "signed int	" << sizeof(signed int) <<  "	" << INT_MIN << endl
		 << "unsigned int	" << sizeof(unsigned int) <<  "	" << UINT_MAX << endl
		 << "lont int	" << sizeof(long int) << "	" << LONG_MAX << endl
		 << "long long int	" << sizeof(long long int) << "	" << LLONG_MAX << endl
		 << "float		" << sizeof(float) << "	" << FLT_MIN  << endl
		 << "double		" << sizeof(double) << "	" << DBL_MIN << endl
		 << "long double	" << sizeof(long double) << "	" << LDBL_MAX << endl
		 << "void		" << sizeof(void*) << endl
		 << "char*		" << sizeof(char*) << endl
		 << "int*		" << sizeof(int*) << endl
		 << "double*		" << sizeof(double*) << endl
		 << "enum Fruits	" << sizeof(Fruits) << "	" << (Fruits)Orange << " = Orange" << endl;

	return 0;
}


Win8 x64一个程序打印出各种基本类型、几个指针类型_第1张图片

你可能感兴趣的:(▷,C\C++)