C语言里%g,g是哪个单词的开头的?

如题所述

C语言里%g,g是单词general的开头首字母,这个单词是一个形容词,中文意思为普遍的,通用的,一般的。在C语言中%g的格式是用来以通用格式输出一个浮点数。由系统来选择,是以%f还是%e输出格式输出六位有效数字,不输出小数尾数的0。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2021-09-24
对g的英文说明:
g,G
A double argument representing a floating-point number is converted in
style f or e (or in style F or E in the case of a G conversion specifier),
depending on the value converted and the precision. Let P equal the
precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
Then, if a conversion with style E would have an exponent of X:
— if P > X ≥ −4, the conversion is with style f (or F) and precision
P − (X + 1).
— otherwise, the conversion is with style e (or E) and precision P − 1.
Finally, unless the # flag is used, any trailing zeros are removed from the
fractional portion of the result and the decimal-point character is removed if
there is no fractional portion remaining.
A double argument representing an infinity or NaN is converted in the style
of an f or F conversion specifier.
我这边有两种理解:

一、%e是指数的首字母,%f是浮点数首字母。而%g是两者自动选择。属于e和f的升级版,所以取e、f之后的字母g来表示。
二、英文单词general的首字母。本回答被提问者采纳
第2个回答  2021-12-07
g是一个字母,以g开头的单词是很多的。比如god,good等等
第3个回答  2021-12-01
c语言中%g中g的单词是general,意为通用,一般的意思。作用是以通用格式输出一个双精度浮点数。
第4个回答  2021-12-16
%g是C语言printf()函数的一个输出格式类型,它表示以%f%e中较短的输出宽度输出单、双精度实数,在指数小于-4或者大于等于精度时使用%e格式。
相似回答