CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C++ 语言

求助!!!!!!!!!!各位大虾!

楼主xuanyue()2006-11-03 20:38:26 在 C/C++ / C++ 语言 提问

c++中无穷大和pi用什么表示啊?位于哪些头文件啊? 问题点数:20、回复次数:7Top

1 楼pcboyxhy(-273.15℃)回复于 2006-11-03 20:42:34 得分 0

没听说过Top

2 楼weijiangshanwww(天气预报:今天会下分,偶尔下几颗星星!)回复于 2006-11-03 20:47:02 得分 2

pi用什么表示?  
  ===============  
   
  PI就是用个变量了,声明为CONST,根据你要的精度,选择是不是长整型,或者LONG   LONG   DOUBLE..  
   
  Top

3 楼weijiangshanwww(天气预报:今天会下分,偶尔下几颗星星!)回复于 2006-11-03 20:48:25 得分 3

选择是不是长整型  
  ===============  
  说错了,是选择是不是LONG   型的.  
   
  至于无穷大,只要给定一个界限就好了.  
   
  我也没见过有无穷大的数Top

4 楼jixingzhong(瞌睡虫·星辰)回复于 2006-11-03 20:48:44 得分 0

limits.hTop

5 楼jixingzhong(瞌睡虫·星辰)回复于 2006-11-03 20:50:23 得分 10

/*    
    *   limits.h  
    *  
    *   Defines   constants   for   the   sizes   of   integral   types.  
    *  
    *   NOTE:   GCC   should   supply   a   version   of   this   header   and   it   should   be   safe   to  
    *               use   that   version   instead   of   this   one   (maybe   safer).  
    *  
    *   This   file   is   part   of   the   Mingw32   package.  
    *  
    *   Contributors:  
    *     Created   by   Colin   Peters   <colin@bird.fu.is.saga-u.ac.jp>  
    *  
    *     THIS   SOFTWARE   IS   NOT   COPYRIGHTED  
    *  
    *     This   source   code   is   offered   for   use   in   the   public   domain.   You   may  
    *     use,   modify   or   distribute   it   freely.  
    *  
    *     This   code   is   distributed   in   the   hope   that   it   will   be   useful   but  
    *     WITHOUT   ANY   WARRANTY.   ALL   WARRANTIES,   EXPRESS   OR   IMPLIED   ARE   HEREBY  
    *     DISCLAIMED.   This   includes   but   is   not   limited   to   warranties   of  
    *     MERCHANTABILITY   or   FITNESS   FOR   A   PARTICULAR   PURPOSE.  
    *  
    *   $Revision:   1.3   $  
    *   $Author:   dannysmith   $  
    *   $Date:   2001/11/29   04:26:33   $  
    *  
    */  
   
  #ifndef   _LIMITS_H_  
  #define   _LIMITS_H_  
   
  /*   All   the   headers   include   this   file.   */  
  #include   <_mingw.h>  
   
  /*  
    *   File   system   limits  
    *  
    *   TODO:   NAME_MAX   and   OPEN_MAX   are   file   system   limits   or   not?   Are   they   the  
    *               same   as   FILENAME_MAX   and   FOPEN_MAX   from   stdio.h?  
    *   NOTE:   Apparently   the   actual   size   of   PATH_MAX   is   260,   but   a   space   is  
    *               required   for   the   NUL.   TODO:   Test?  
    */  
  #define   PATH_MAX (259)  
   
  /*  
    *   Characteristics   of   the   char   data   type.  
    *  
    *   TODO:   Is   MB_LEN_MAX   correct?  
    */  
  #define   CHAR_BIT 8  
  #define   MB_LEN_MAX 2  
   
  #define   SCHAR_MIN (-128)  
  #define   SCHAR_MAX 127  
   
  #define   UCHAR_MAX 255  
   
  /*   TODO:   Is   this   safe?   I   think   it   might   just   be   testing   the   preprocessor,  
    *               not   the   compiler   itself...   */  
  #if ('\x80'   <   0)  
  #define   CHAR_MIN SCHAR_MIN  
  #define   CHAR_MAX SCHAR_MAX  
  #else  
  #define   CHAR_MIN 0  
  #define   CHAR_MAX UCHAR_MAX  
  #endif  
   
  /*  
    *   Maximum   and   minimum   values   for   ints.  
    */  
  #define   INT_MAX 2147483647  
  #define   INT_MIN (-INT_MAX-1)  
   
  #define   UINT_MAX 0xffffffff  
   
  /*  
    *   Maximum   and   minimum   values   for   shorts.  
    */  
  #define   SHRT_MAX 32767  
  #define   SHRT_MIN (-SHRT_MAX-1)  
   
  #define   USHRT_MAX 0xffff  
   
  /*  
    *   Maximum   and   minimum   values   for   longs   and   unsigned   longs.  
    *  
    *   TODO:   This   is   not   correct   for   Alphas,   which   have   64   bit   longs.  
    */  
  #define   LONG_MAX 2147483647L  
   
  #define   LONG_MIN (-LONG_MAX-1)  
   
  #define   ULONG_MAX 0xffffffffUL  
   
   
  /*  
    *   The   GNU   C   compiler   also   allows   'long   long   int'  
    */  
  #if !defined(__STRICT_ANSI__)   &&   defined(__GNUC__)  
   
  #define   LONG_LONG_MAX 9223372036854775807LL  
  #define   LONG_LONG_MIN (-LONG_LONG_MAX-1)  
   
  #define   ULONG_LONG_MAX (2ULL   *   LONG_LONG_MAX   +   1)  
   
  /*   ISO   C9x   macro   names   */  
  #define   LLONG_MAX   LONG_LONG_MAX  
  #define   LLONG_MIN   LONG_LONG_MIN  
  #define   ULLONG_MAX   ULONG_LONG_MAX  
   
  #endif   /*   Not   Strict   ANSI   and   GNU   C   compiler   */  
   
   
  #endif   /*   not   _LIMITS_H_   */  
   
   
  该文件定义了各个类型的极限值,  
  C++   没有表示   无穷   这样的数据的   ~Top

6 楼blue_zyb()回复于 2006-11-05 13:34:47 得分 2

IEEE浮点表示法中,指数位全部为1,小数位全部为0表示为无穷。  
  如果符号位为0,表示正无穷;  
  如果符号位为1,表示负无穷。  
  Top

7 楼zuozhuwu()回复于 2006-11-05 21:26:28 得分 3

pi   在math.h中有定义  
  最大值:  
  #include<limits>  
  numeric_limits<T>::max();返回的就是最大值,其中T代表类型,int,double都行Top

相关问题

关键词

得分解答快速导航

  • 帖主:xuanyue
  • weijiangshanwww
  • weijiangshanwww
  • jixingzhong
  • blue_zyb
  • zuozhuwu

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo