[转]C/C++中的基本类型和极大极小值
来源:互联网 发布:zbrush 4r8 mac破解版 编辑:程序博客网 时间:2024/05/12 23:08
C/C++中的基本类型和极大极小值不说什么了,看源代码和结果一目了然。:)/************************************************************************//* show some c++ constant *//* author : smileonce *//* date : 2004-11-07 *//************************************************************************/#include "stdafx.h"#include #include using namespace std;int main(int argc, char* argv[]){cout << "the size of char : " << sizeof(char) << endl << "the size of int : " << sizeof(int) << endl << "the size of double : " << sizeof(double) << endl // << "the size of void : " << sizeof(void) << endl // sizeof(void) --> warning #70: incomplete type is not allowed // but the system print result, the size of void is 0 << "the size of unsigned char : " << sizeof(unsigned char) << endl << "the size of signed char : " << sizeof(signed char) << endl << "the size of unsigned int : " << sizeof(unsigned int) << endl << "the size of signed int : " << sizeof(signed int) << endl << "the size of short int : " << sizeof(short int) << endl << "the size of long int : " << sizeof(long int) << endl << "the size of float : " << sizeof(float) << endl << "the size of long double : " << sizeof(long double) << endl << "the size of bool : " << sizeof(bool) << endl;cout << "the size of char * : " << sizeof(char *) << endl << "the size of int * : " << sizeof(int *) << endl << "the size of double * : " << sizeof(double *) << endl << "the size of void * : " << sizeof(void *) << endl << "the size of bool * : " << sizeof(bool *) << endl;cout << "smallest char == " << (int)numeric_limits::min() << endl << "largest char == " << (int)numeric_limits::max() << endl << "is the char singed ? " << numeric_limits::is_signed << endl << "smallest int == " << numeric_limits::min() << endl << "largest int == " << numeric_limits::max() << endl << "smallest double == " << numeric_limits::min() << endl << "largest double == " << numeric_limits::max() << endl << "smallest bool == " << numeric_limits::min() << endl << "largest bool == " << numeric_limits::max() << endl << "smallest short == " << numeric_limits::min() << endl << "largest short == " << numeric_limits::max() << endl << "smallest long == " << numeric_limits::min() << endl << "largest long == " << numeric_limits::max() << endl << "smallest float == " << numeric_limits::min() << endl << "largest float == " << numeric_limits::max() << endl << "smallest long double == " << numeric_limits::min() << endl << "largest long double == " << numeric_limits::max() << endl;cout << "smallest unsigned char == " << (unsigned int)numeric_limits::min() << endl << "largest unsigned char == " << (unsigned int)numeric_limits::max() << endl << "smallest unsigned int == " << numeric_limits::min() << endl << "largest unsigned int == " << numeric_limits::max() << endl << "smallest unsigned short == " << numeric_limits::min() << endl << "largest unsigned short == " << numeric_limits::max() << endl << "smallest unsigned long == " << numeric_limits::min() << endl << "largest unsigned long == " << numeric_limits::max() << endl; return 0;}在windows 2000下,输出结果如下:the size of char : 1the size of int : 4the size of double : 8the size of unsigned char : 1the size of signed char : 1the size of unsigned int : 4the size of signed int : 4the size of short int : 2the size of long int : 4the size of float : 4the size of long double : 8the size of bool : 1the size of char * : 4the size of int * : 4the size of double * : 4the size of void * : 4the size of bool * : 4smallest char == -128largest char == 127is the char singed ? 1smallest int == -2147483648largest int == 2147483647smallest double == 2.22507e-308largest double == 1.79769e+308smallest bool == 0largest bool == 1smallest short == -32768largest short == 32767smallest long == -2147483648largest long == 2147483647smallest float == 1.17549e-038largest float == 3.40282e+038smallest long double == 2.22507e-308largest long double == 1.79769e+308smallest unsigned char == 0largest unsigned char == 255smallest unsigned int == 0largest unsigned int == 4294967295smallest unsigned short == 0largest unsigned short == 65535smallest unsigned long == 0largest unsigned long == 4294967295注:为了使网页尽可能显示美观,我插入了很多空格。所以,如果你把上面的代码直接copy到vc6.0中运行,输出结果的排版可能不同(没这么整齐)。:)
- [转]C/C++中的基本类型和极大极小值
- 求极大和极小值
- C语言——极大极小搜索
- 极大极小值算法
- C---高低字节转换、printf本质、有无符号的极大极小值、_Bool
- C语言中的基本类型
- C语言中的基本类型
- c语言中的基本类型
- 打印C++中的极大极小数值
- 在c/c++中的基本类型赋值和初始化
- C++:基本类型和变量
- 牛顿法求极大极小值
- 三分法求凸性函数极大极小值
- 极大极小博弈树(转)
- 寻找极小值(C百例)
- C/C++中的内置基本类型
- c语言中的基本类型(2)
- 漫步微积分十四——增、减函数和极大、极小值
- Oracle manage roles
- 从面向对象到SOA
- 脱壳之一
- VC 隐藏任务栏,实现对话框的全屏显示
- OpenSUSE Smeegol 1.0 发布,添加MeeGo特色界面
- [转]C/C++中的基本类型和极大极小值
- 两岸三地高校发报告称富士康滥用学生劳动力
- 诺基亚MeeGo手机界面首现演示(视频)
- Sql之left join、right join、inner join的区别(转载)
- dgfdgd
- Oracle auditing
- Proteus绿色版6.7与汉化文件,
- ExtJS中Ext.Ajax.request与form1.getForm().submit的基本区别
- 运算符的优先级和结合性总结