十进制数的数据类型 [英] data type for decimal number

查看:157
本文介绍了十进制数的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是最好的格式说明符(数据类型),如果我必须使用

十进制数。


也请告诉我截断的语法一个十进制数


请尽快回复

which is the best format specifier(data type) if i have to work with
decimal number.

also please tell me the syntax for truncating a decimal number

please reply as soon as possible

推荐答案

ne ********** @ yahoo.co.in 说:

这是最好的格式说明符(数据类型),如果我必须使用

十进制数。
which is the best format specifier(data type) if i have to work with
decimal number.



没有十进制数这样的东西。数字是数字。但是

大概你的意思是你希望用十进制

表示法显示一个数字,你对格式说明符的引用表明你希望

使用printf执行此操作。


如果您有int类型,请使用%d或%i。对于short int和long int,应用

相应的修饰符,如C book中所列(在K& R2中,它们是在
第244页)。对于unsigned int类型,请使用%u而不是%d或%i。


如果要显示浮点类型,请使用%f。

There is no such thing as a "decimal number". Numbers are numbers. But
presumably you mean that you wish to display a number using decimal
notation, and your reference to a format specifier suggests that you wish
to do this using printf.

If you have an int type, use %d or %i. For short int and long int, apply
the appropriate modifiers, as listed in your C book (in K&R2 they''re on
page 244). For unsigned int types, use %u rather than %d or %i.

If you wish to display a floating point type, use %f.


也请告诉我截断十进制数的语法
also please tell me the syntax for truncating a decimal number



这取决于你的意思截断"以及你希望截断什么类型的价值(特别是关于你是否希望将存储的值兑换成
,或仅仅是显示的值)。


-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http://万维网。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

This depends on what you mean by "truncate" and on what type of value you
wish to truncate (and particularly on whether you want the stored value to
be truncated, or merely the displayed value).

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


2008年2月16日星期六18:50:57 +0000,Richard Heathfield

< rj * @ see .sig.invalidwrote:
On Sat, 16 Feb 2008 18:50:57 +0000, Richard Heathfield
<rj*@see.sig.invalidwrote:

>没有十进制数这样的东西。数字是数字。但是大概你的意思是你想用十进制
表示法显示一个数字,你对格式说明符的引用表明你希望使用printf来做这个。
>There is no such thing as a "decimal number". Numbers are numbers. But
presumably you mean that you wish to display a number using decimal
notation, and your reference to a format specifier suggests that you wish
to do this using printf.



一个小问题。标准确实使用术语十进制数和在strftime()的

部分。它的含义正是你所写的关于

显示的内容,但我会避免写出没有这样的东西......

你知道总有一个例外。 ;-)

A tiny point. The Standard does use the term "decimal number" in the
section on strftime(). Its meaning is exactly what you wrote about
display, but I would avoid writing that there is no such thing as ....
You know that there is always an exception. ;-)


Robert W Hand说:
Robert W Hand said:

2008年2月16日星期六18:50:57 +0000,Richard Heathfield

< rj *@see.sig.invalidwrote:
On Sat, 16 Feb 2008 18:50:57 +0000, Richard Heathfield
<rj*@see.sig.invalidwrote:

>>没有这样的事情a十进制数。数字是数字。但是大概你的意思是你想用十进制
表示法显示一个数字,你对格式说明符的引用表明你希望使用printf来做这个。
>>There is no such thing as a "decimal number". Numbers are numbers. But
presumably you mean that you wish to display a number using decimal
notation, and your reference to a format specifier suggests that you wish
to do this using printf.



一个小问题。标准确实使用术语十进制数和在strftime()的

部分。它的含义正是你所写的关于

显示的内容,但我会避免写出没有这样的东西......

你知道总有一个例外。 ;-)


A tiny point. The Standard does use the term "decimal number" in the
section on strftime(). Its meaning is exactly what you wrote about
display, but I would avoid writing that there is no such thing as ....
You know that there is always an exception. ;-)



标准使用术语十进制数的事实并不意味着

有十进制数这样的东西。它只是意味着编写标准部分的人们认为这样的事情会产生这样的结果:

十进制数。


-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

The fact that the Standard uses the term "decimal number" does not mean
there is such a thing as a decimal number. It merely means that the people
who wrote that part of the Standard think there is such a thing as a
decimal number.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


这篇关于十进制数的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆