C语言中格式操作符中“%a”是什么意思?

Python013

C语言中格式操作符中“%a”是什么意思?,第1张

%a是以指数形式输出一个浮点数(十六进制)。

1.%a浮点数,十六进制数字和p-记数法(C99)%A浮点数,十六进制数字和p-记法(C99)。

2.把一个浮点数以一个十六进制的数如0x1.C0000p+1类似的样子输出一个浮点数,这是C99中才有的功能,strftime()函数将时间格式化,%a 星期几的简写。

3.Signed hexadecimal double precision floating point value having the form [−]0xh.hhhh p±dd, where h.hhhh are the hex digits (using lower case letters) of the mantissa, and dd are one or more digits for the exponent. The precision specifies the number of digits after the point。

4.Signed hexadecimal double precision floating point value having the form [−]0Xh.hhhh P±dd, where h.hhhh are the hex digits (using capital letters) of the mantissa, and dd are one or more digits for the exponent. The precision specifies the number of digits after the point。

需要准备的材料分别有:电脑、C语言编译器

1、首先,打开C语言编译器,新建一个初始.cpp文件,例如:test.cpp。

2、在test.cpp文件中,输入C语言代码:int a = 127printf("%x", a) 。

3、编译器运行test.cpp文件,此时成功将数字用十六进制进行了输出。