C语言极限值。

magina_hh 2009-08-04 04:28:59

那我想请问下C语里极限值的这种语句的具体作用是什么。

我看了很久教材都没有看懂他的实际用途。
...全文
503 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
AnYidan 2011-08-04
  • 打赏
  • 举报
回复
计算机中的数值与现实中的不同,有精度和范围
huangxianzong 2011-08-04
  • 打赏
  • 举报
回复
mu_yang 。你刚学的C吧,SB
kecookier 2011-08-04
  • 打赏
  • 举报
回复
定义宏的时候可能用到limits.h中的边界值
赵4老师 2011-08-04
  • 打赏
  • 举报
回复
C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\limits.h
C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\float.h
TitanQuest 2011-08-04
  • 打赏
  • 举报
回复
[Quote=引用 20 楼 huangxianzong 的回复:]

mu_yang 。你刚学的C吧,SB
[/Quote]
。。。。。。。。
mu_yang 2009-08-06
  • 打赏
  • 举报
回复
[Quote=引用 17 楼 magina_hh 的回复:]
那怎么画呢。
[/Quote]

首先你得明白
printf()只能画“字符”组成的画
比如在屏幕上画一个三角形

****
***
**
*

这可以这样实现


#include <stdio.h>

int main(void)
{

printf("****\n");
printf("***\n");
printf("**\n");
printf("*\n");

return 0;

}


这个你画好了之后我教你画美女
magina_hh 2009-08-06
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 mu_yang 的回复:]
引用 13 楼 magina_hh 的回复:
  这样的。


我猜那书的意思是教你学会printf()函数调用语句
另一个是14楼说的作用
这不是“极限值的这种语句”
叫函数调用语句
书是想帮你了解printf()函数的使用方法
printf()很常用
不知道你上一个代码编译通过没有
要是通过了
如果你愿意
我可以教你用它画画
[/Quote]


那怎么画呢。
jack_wq 2009-08-06
  • 打赏
  • 举报
回复
呵呵呵呵~~~
mu_yang 2009-08-05
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 magina_hh 的回复:]
这样的。
[/Quote]

我猜那书的意思是教你学会printf()函数调用语句
另一个是14楼说的作用
这不是“极限值的这种语句”
叫函数调用语句
书是想帮你了解printf()函数的使用方法
printf()很常用
不知道你上一个代码编译通过没有
要是通过了
如果你愿意
我可以教你用它画画
ForestDB 2009-08-05
  • 打赏
  • 举报
回复
表示了你当前平台的能力。
magina_hh 2009-08-05
  • 打赏
  • 举报
回复
#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 tu %llu",
ULLONG_MAX);
printf("\n\nThe size of the smallest non-zero value of type float is %.3e",
FLT_MIN);
printf("\nThe size of the largest value of type float is %.3e",
FLT_MAX);
printf("\nThe size of the smallest non-zero value of type double is %.3e,
DBLE_MIN);
printf("\nThe size of the largest value of type double is %.3e",
DBL_MAX);
printf("\nThe size of the smallest non-zero value ~CCC of type long double is %.3Le",
LDBL_MIN);
printf("\nThe size of the largest value of type long double is %.3Le\n",
LDBL_MAX);
printf("\nVariables of type float provide %u decimal digits precision.",
FLT_DIG);
printf("\nVariables of type double provide %u decimal digits precision.",
DBL_DIG);
printf("\nVariables of type long double provide %u decimal digits precision.",
LDBL_DIG);

return 0;

}



这样的。
joyer688 2009-08-05
  • 打赏
  • 举报
回复
up
hyyuanqiang 2009-08-04
  • 打赏
  • 举报
回复
交叉编译?
还是 limit.h 里边的那些无聊的东西
zhangjie199011087 2009-08-04
  • 打赏
  • 举报
回复
C++语言有个std::numeric_limits<类型>::max();可以求类型的最大值!
czj19891224 2009-08-04
  • 打赏
  • 举报
回复
其实也没什么大作用,就是比较容易框定了一个范围,有时用来作类型之间的比较
Zijian_Zhang 2009-08-04
  • 打赏
  • 举报
回复
是不是int的上限那些东西啊,那些书本上的实例是说给你听有个范围的意思,应该没有实际用途。
xu044 2009-08-04
  • 打赏
  • 举报
回复
楼主说的应该是limits.h里定义的限制吧?
guoyichao 2009-08-04
  • 打赏
  • 举报
回复
limits.h?编译器提供的头文件,表明这个编译器支持类型的上下限什么的,也指明了该编译器的目标平台的一些类型上下限,可以用gcc搞个实验,做几个交叉编译器进行交叉编译就明白了。
mstlq 2009-08-04
  • 打赏
  • 举报
回复
劝楼主学学提问的艺术^_^
给疑惑的朋友们一个传送门,也是楼主的帖子
http://topic.csdn.net/u/20090803/23/5d027d0b-daa5-4b65-ad94-5bc5133b5137.html?57341
asksgp 2009-08-04
  • 打赏
  • 举报
回复
问题都没说清,来问个啥。。。
加载更多回复(4)
内容概要:本文详细介绍了使用C语言实现一个支持多运算符与括号的简易计算器的全过程,涵盖需求分析、功能设计、核心算法实现及测试验证。重点讲解了中缀表达式转后缀表达式(逆波兰表达式)的算法原理与实现方法,利用栈结构处理运算符优先级和括号匹配,并通过后缀表达式进行高效计算。文章还提供了完整的C语言代码示例,包括表达式解析、计算函数、错误处理机制(如非法字符检测、括号匹配检查)以及主函数的编写,并通过多个测试用例验证了程序的正确性与稳定性。 适合人群:具备C语言基础语法知识、了解基本数据结构(尤其是栈)的初学者或编程爱好者,适合学习算法应用与程序设计逻辑的学生和初级开发者。 使用场景及目标:①掌握中缀转后缀表达式的算法思想及其在实际项目中的应用;②理解栈在表达式求值中的关键作用;③提升对输入合法性校验、错误处理等程序健壮性设计的认知;④作为C语言综合实践项目,巩固函数模块化设计与调试能力。 阅读建议:建议读者结合文中提供的代码逐步动手实现,重点关注栈的操作逻辑与表达式处理流程,调试不同输入案例以加深理解,并尝试在此基础上扩展更多数学函数(如sin、log)或优化性能,进一步提升项目实用性。

70,038

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧