原标题:编程字典-C语言打印输出浮点类型示例
C语言打印输出浮点类型
/* showf_pt.c -- displays float value in two ways */
#include
int main(void)
{
float aboat = 32000.0;
double abet = 2.14e9;
long double dip = 5.32e-5;
printf("%f can be written %e\n", aboat, aboat);
// next line requires C99 or later compliance
printf("And it's %a in hexadecimal, powers of 2 notation\n", aboat);
printf("%f can be written %e\n", abet, abet);
printf("%Lf can be written %Le\n", dip, dip);
return 0;
}
原文:http://codingdict.com/article/10641返回搜狐,查看更多
责任编辑: