永发信息网

C语言考试题不明白

答案:6  悬赏:30  手机版
解决时间 2021-02-05 22:06
  • 提问者网友:黑米和小志
  • 2021-02-05 10:03
C语言考试题不明白
最佳答案
  • 五星知识达人网友:等灯
  • 2021-02-05 10:31
%d 有符号十进制数 %0 八进制 %x 十六进制
格式输出 八进制和十六进制 是没有负数的 所以实际输出的是将 -2 转化为二进制 (补码) 再转化为 十进制数
全部回答
  • 1楼网友:酒醒三更
  • 2021-02-05 14:08
在16位的环境下,应该是(C),如果是32位没有答案。
%d int 有符号的十进制数
%o int 无符号的八进制数
%x int 无符号的十六进制数
%u int 无符号的十进制数
更详细的,你可以通过MSDN获得:
Character Type Output format
c int or wint_t When used with printf functions, specifies a single-byte character; when used with wprintf functions, specifies a wide character.
C int or wint_t When used with printf functions, specifies a wide character; when used with wprintf functions, specifies a single-byte character.
d int Signed decimal integer.
i int Signed decimal integer.
o int Unsigned octal integer.
u int Unsigned decimal integer.
x int Unsigned hexadecimal integer, using "abcdef."
X int Unsigned hexadecimal integer, using "ABCDEF."
e double Signed value having the form [ – ]d.dddd e [sign]ddd where d is a single decimal digit, dddd is one or more decimal digits, ddd is exactly three decimal digits, and sign is + or –.
E double Identical to the e format except that E rather than e introduces the exponent.
f double Signed value having the form [ – ]dddd.dddd, where dddd is one or more decimal digits. The number of digits before the decimal point depends on the magnitude of the number, and the number of digits after the decimal point depends on the requested precision.
g double Signed value printed in f or e format, whichever is more compact for the given value and precision. The e format is used only when the exponent of the value is less than –4 or greater than or equal to the precision argument. Trailing zeros are truncated, and the decimal point appears only if one or more digits follow it.
G double Identical to the g format, except that E, rather than e, introduces the exponent (where appropriate).
n Pointer to integer Number of characters successfully written so far to the stream or buffer; this value is stored in the integer whose address is given as the argument.
p Pointer to void Prints the address of the argument in hexadecimal digits.
s String When used with printf functions, specifies a single-byte–character string; when used with wprintf functions, specifies a wide-character string. Characters are printed up to the first null character or until the precision value is reached.
S String When used with printf functions, specifies a wide-character string; when used with wprintf functions, specifies a single-byte–character string. Characters are printed up to the first null character or until the precision value is reached.

参考资料:MSDN

  • 2楼网友:时间的尘埃
  • 2021-02-05 13:48
b鏄痷nsigned鍨嬫暟鎹?紝涓嶈兘鏄?礋鏁帮紝瀹幂殑鍙栧€艰寖锲存槸0~65535銆
%鏄?浆涔夊瓧绗》殑鍓岖紑锛屼篃灏辨槸璇村彧瑕丆绯荤粺瑙勫畾镄勮浆涔夊瓧绗】紝鍓嶉溃閮芥湁涓€涓?鍙枫€傛瘮濡?d锛屽氨鏄?〃绀轰互鍗佽繘鍒舵暣鍨嬫暟鎹?緭鍑烘垨钥呰緭鍏ャ€?x琛ㄧず浠?6杩涘埗銆?o琛ㄧず浠ュ叓杩涘埗杈揿叆鎴栬€呰緭鍑恒€
濡傛灉灏哹瀹氢箟涓篿nt鍨嬶紝灏变笉浼氩彂鐢熸暟鎹?孩鍑猴紝濡傦细
int b=a;
  • 3楼网友:十年萤火照君眠
  • 2021-02-05 12:04
奶油葡萄 -已经回答
我想说的是,记得谭老妖的C语言书里有一个列表!自己为什么不看书?
  • 4楼网友:猎心人
  • 2021-02-05 10:43
%d,%o,%x
如果我没有记错的话,应该是请以十进制,16进制,8进制分别输出的意思
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯