| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4636 人关注过本帖
标题:新手菜鸟问题 关于< limits.h > 这个头文件
只看楼主 加入收藏
wrywry212
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2012-6-17
结帖率:75%
收藏
已结贴  问题点数:20 回复次数:8 
新手菜鸟问题 关于< limits.h > 这个头文件
本菜鸟刚开始自学C语言 学的是那本清华大学出版社的红色的《C语言入门经典》 其中有一个程序如下:
/* Program 2.11 Finding the limits  */
#include <stdio.h>      /* For command line input and output  */
#include < limits.h >   /* For limits on integer types        */
#include <float.h>      /* For limits on floating-point types */

int main(void)
{
  printf("Variables of type char store values from %d to %d",
                                                  CHAR_MIN, CHAR_MAX);
  printf("\nVariables of type unsigned char store values from 0 to %u",
                                                           UCHAR_MAX);
  printf("\nVariables of type short store values from %d to %d",
                                                 SHRT_MIN, SHRT_MAX);
  printf("\nVariables of type unsigned short store values from 0 to %u",
                                                         USHRT_MAX);
  printf("\nVariables of type int store values from %d to %d", INT_MIN, INT_MAX);
  printf("\nVariables of type unsigned int store values from 0 to %u", UINT_MAX);
  printf("\nVariables of type long store values from %ld to %ld",
                                               LONG_MIN, LONG_MAX);
  printf("\nVariables of type unsigned long store values from 0 to %lu",
                                                        ULONG_MAX);
  printf("\nVariables of type long long store values from %lld to %lld",
                                               LLONG_MIN, LLONG_MAX);
  printf("\nVariables of type unsigned long long store values from 0 to %llu",
                                                        ULLONG_MAX);

就是那个头文件 < limits.h > ,我在Win Tc 和C-Free 这两个编译器下 都显示:No such file or directory. 不晓得该怎么办   请前辈指点
如果这个问题很二  别笑我 呵呵           谢谢

还有麻烦推荐一个好的编译器   再次感谢
搜索更多相关主题的帖子: 清华大学 command include limits 
2012-06-17 18:52
zklhp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:china
等 级:贵宾
威 望:254
帖 子:11485
专家分:33241
注 册:2007-7-10
收藏
得分:0 
两种可能 一种是没有 一种是编译器找不着

你先搜索一下有没有这个文件再说

图片附件: 游客没有浏览图片的权限,请 登录注册

2012-06-17 19:05
zklhp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:china
等 级:贵宾
威 望:254
帖 子:11485
专家分:33241
注 册:2007-7-10
收藏
得分:0 
我在Win Tc 和C-Free 这两个编译器下

注意 你说的这两个都是不是编译器 应该算个IDE 至于编译器和IDE分别是什么欢迎自行百度
2012-06-17 19:07
邱威
Rank: 5Rank: 5
等 级:职业侠客
威 望:2
帖 子:136
专家分:351
注 册:2012-3-28
收藏
得分:7 
VC6.0   你是不是把程序写错了:倒数两个printf里面的LLONG_MIN,LLONG_MAX,ULLONG_MAX,<limits.h>里面定义的是:LONG_MIN,LONG_MAX,ULONG_MAX;还有你的代码也没有个return,,,
2012-06-17 19:17
zklhp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:china
等 级:贵宾
威 望:254
帖 子:11485
专家分:33241
注 册:2007-7-10
收藏
得分:7 
以下是引用邱威在2012-6-17 19:17:55的发言:

VC6.0   你是不是把程序写错了:倒数两个printf里面的LLONG_MIN,LLONG_MAX,ULLONG_MAX,里面定义的是:LONG_MIN,LONG_MAX,ULONG_MAX;还有你的代码也没有个return,,,
问题是找不到头文件 而且他程序都没贴全要什么return啊

2012-06-17 19:20
wrywry212
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2012-6-17
收藏
得分:0 
回复 楼主 wrywry212
我搜了下 有这个文件
图片附件: 游客没有浏览图片的权限,请 登录注册
     但还是不行
图片附件: 游客没有浏览图片的权限,请 登录注册
  代码肯定没错 用的是书中自带的

谢谢
2012-06-17 21:21
wrywry212
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2012-6-17
收藏
得分:0 
回复 2楼 zklhp
我搜了下 有这个文件
图片附件: 游客没有浏览图片的权限,请 登录注册
     但还是不行
图片附件: 游客没有浏览图片的权限,请 登录注册
  

代码肯定没错 用的是书中自带的

谢谢
2012-06-17 21:24
hellovfp
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:禁止访问
威 望:30
帖 子:2976
专家分:7697
注 册:2009-7-21
收藏
得分:7 
/* Program 2.11 Finding the limits  */
#include <stdio.h>      /* For command line input and output  */
#include <limits.h>   /* For limits on integer types        */
#include <float.h>      /* For limits on floating-point types */

int main(void)
{
  printf("Variables of type char store values from %d to %d",
                                                  CHAR_MIN, CHAR_MAX);
  printf("\nVariables of type unsigned char store values from 0 to %u",
                                                           UCHAR_MAX);
  printf("\nVariables of type short store values from %d to %d",
                                                 SHRT_MIN, SHRT_MAX);
  printf("\nVariables of type unsigned short store values from 0 to %u",
                                                         USHRT_MAX);
  printf("\nVariables of type int store values from %d to %d", INT_MIN, INT_MAX);
  printf("\nVariables of type unsigned int store values from 0 to %u", UINT_MAX);
  printf("\nVariables of type long store values from %ld to %ld",
                                               LONG_MIN, LONG_MAX);
  printf("\nVariables of type unsigned long store values from 0 to %lu",
                                                        ULONG_MAX);
  printf("\nVariables of type long long store values from %I64d to %I64d",
                                               LLONG_MIN, LLONG_MAX);
  printf("\nVariables of type unsigned long long store values from 0 to %I64ud",
                                                        ULLONG_MAX);
  return 0;
}

我们都在路上。。。。。
2012-06-18 10:53
wrywry212
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2012-6-17
收藏
得分:0 
谢谢各位啦  

经研究发现  是#include < limits.h >   /* For limits on integer types        */    这行代码中   limits.h前后多了空格  我把这个错误改了就ok了  但不是说空格是自动忽略的嘛 就这个小毛病看了很多资料..........   汗死了.......  
2012-06-18 20:05
快速回复:新手菜鸟问题 关于< limits.h > 这个头文件
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022956 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved