printf函数格式化控制字符详解
文章类别: 培训作业 0 评论

printf函数格式化控制字符详解

文章类别: 培训作业 0 评论

老师未批改

3. printf 详解笔记.

函数原型

int printf( const char *format, ... );
int printf( const char *restrict format, ... );

参数介绍

我们先来学习下我们的printf函数:
翻译的不好请见谅!
您也可以看 下面从网站上引用的原信息.

stream - 输出流, 比如是文件(FILE), 标准输出流(stdout), 字符串缓冲区(buffer)
buffer - 指向要写入的一个字符串缓冲区的指针.
bufsz - 指定要写入的长度, 会写入 bufsz - 1 个字符, 然后附加一个'\0'到.
format - 指向一个包含结束符('\0')的规定如何解释数据(格式化)的多字节的特殊字符串的指针.
    格式化字符串包含普通的多字节字符, 格式化格式字符(不包括%), 和转义字符. 在输出到输出流时, 普通字符被复制, 不会改变, 转义字符会被转义, 格式化格式字符(转换规范)将会被格式化.
    format这个参数的格式基本上可以表示为:   %[flags][width][.prec][F|N|h|l]type 
    具体解释如下:
        · 以 % 为开始字符.
        · 标志(flags) - (可选的) 一个或多个可以修改(控制)转换行为的标识字符.
            · -: 将转换结果在字段内变为左对齐.(默认是右对齐的)
            · +: 将有符号的转换结果加上符号, 默认的没有正数符号. 
            · 空格: 如果结果是一个有符号的转换结果, 但是并没有符号字符(+, -), 则空格将会补齐它. 在存在"+"标志的时候, 空格标志不生效. 
            · #: 在执行的时候进行替换. 具体请参照下边的表格详细说明.
            · 0: 对整数和浮点数转换来说, 使用0来代替使用空格补全指定的长度.
                对整数来说, 如果显示指定了精度, 该标志将会被忽略.
                如果其他的转换使用了这个标志, 结果将是未定义的行为, 即可能会出错, 不能预知正确的结果.
                如果有标志"-", 则忽略该标志.
        · 位数(width) - (可选的) 用一个整数, 或者"*"来指定字段的最小长度. 默认的它会使用空格进行补齐. 
            如果规定了该参数, 那么如果是左对齐就在右侧补齐, 如果是右对齐就在左侧补齐.
            如果使用了"*", 必须传递一个int类型的参数. 如果给定的是一个负数, 那么与指定标识"-"结果类似, 使用该结果的默认长短.
            (注意: 这里是规定的最小长度, 如果超出了这个长度, 结果不会被截断.)
        · 精度(.prec) - (可选的) 在字符"."后紧跟一个整数或一个"*"字符, 或者不指定转换的精度.
            如果使用了"*", 必须传递一个int类型的参数. 如果给定的是一个负数, 那么该参数将被忽略.
            如果既没有数字也没有"*"被指定, 那么精度为0.
        · (可指定的) 指定的参数大小的长度修饰符
        · 转换格式说明符

具体转换说明符表:

<td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A
转换
说明符
解释 参数类型
长度修饰符 hh h (none) l ll j z t L
% 输出字符 %. 完整的转换描述符的写法应该是 %%.
c <dl> <dd> 输出单个字符. </dd> </dl> <p> 参数会被转换为 <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw4">unsigned</span> <span class="kw4">char</span></span></span>. 如果使用了 l 修饰符, 即使用 %lc , 参数会被转换为一个字符串, 就像<span class="t-c"><span class="mw-geshi c source-c"> <span class="kw4">wchar_t</span><span class="br0">[</span><span class="nu0">2</span><span class="br0">]</span></span></span>类型的参数使用 %ls 修饰符一样. </p> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">int</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c">wint_t</span></span></div> </div>
s <dl> <dd> 输出 字符串 </dd> </dl> <p> 参数必须是一个指向字符数组首元素的指针. 精度 指定要写入的字节的最大数目。如果 精度 没有指定, 将写入每个字节,直到遇到第一个终止符('0')。 如果指定了 l 修饰符, 即(%ls) , 则参数必须是一个指向 <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">wchar_t</span></span></span>类型的数组首元素的指针, 其中, 如果调用 <span class="t-lc"> wcrtomb</span> 进行初始化, 参数将会被转换为char型的数组. <span style="color:red">(最后一句英文比较蹩脚, 不知翻译的对不对)</span> </p> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">char</span><span class="sy2">*</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">wchar_t</span><span class="sy2">*</span></span></span></div> </div>
d
i
<dl> <dd> 将一个有符号整数转换成十进制表示形式 [-]dddd. </dd> </dl> <p> 精度 指定了要显示的数字的最小数目。默认精度是 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span>。
如果精度和被转换的参数都为 <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span>, 那么转换结果将为空. </p>
<div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">signed</span> <span class="kw4">char</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">short</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">int</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span> <span class="kw4">long</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw118">intmax_t</span></span></span></div> </div> <div class="t-vertical"> <div> signed <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw100">size_t</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw101">ptrdiff_t</span></span></span></div> </div>
o <dl> <dd> 将一个无符号整数转换成八进制表示形式 oooo. </dd> </dl> <p> 精度 指定了要显示的数字的最小数目。默认精度是 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span>. 如果精度和被转换的参数都为 <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span>, 那么转换结果将为空. 如果有必要提高精度, 有一种 代替的实现方法, 就是写一个前导0(%0o). 在这个方案中, 如果被转换参数和精度都是 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">0</span></span></span>, 转换结果将会出现一个 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">0</span></span></span>. </p> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">char</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">short</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">int</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">long</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">long</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw132">uintmax_t</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw100">size_t</span></span></span></div> </div> <div class="t-vertical"> <div> unsigned version of <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw101">ptrdiff_t</span></span></span></div> </div>
x
X
<dl> <dd> 将一个无符号整数转换成十六进制表示形式 hhhh. </dd> </dl> <p> 当修饰符是小写 x 的时候, 转换结果将使用小写字母 abcdef.
当修饰符是大写 X 的时候, 转换结果将使用大写字母 ABCDEF.
精度 指定了要显示的数字的最小数目。默认精度是 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span>. 如果被转换的参数和精度都是 <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span> , 那么转换结果将为空. 如果想要转换结果为非0, 可以使用这种 代替的实现方法 , 就是在转换修饰符前加 0x 或者 0X (%0x 或者 %0X). </p>
u <dl> <dd> 将一个无符号整数 转换成十进制表示形式 dddd. </dd> </dl> <p> 精度 指定了要显示的数字的最小数目。默认精度是 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span>. 如果被转换的参数和精度都是 <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span> ,那么转换结果将为空. </p>
f
F
<dl> <dd> 将一个 浮点数 转换为十进制形式 [-]ddd.ddd. </dd> </dl> <p> 精度 指定了小数点之后出现的数字的最小数目。默认精度是 <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">6</span></span></span>. 如果想要实现不是浮点数也要显示小数点, 可以使用这种代替的解决方法 . 对于无限小数和非数字的转换风格, 请看说明. <span style="color:red">(最后一句英文比较绕口, 不知翻译的对不对)</span> </p> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">double</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">double</span></span></span> <span class="t-mark-rev t-since-c99">(since C99)</span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span> <span class="kw4">double</span></span></span></div> </div>
e
E
<dl> <dd> 将一个 浮点数 转换为十进制的指数表示法(科学计数法)。 </dd> </dl> <p> 如果转换修饰符是小写 e , 那么转换风格是 [-]d.ddde±dd
如果转换修饰符是大写 E , 那么转换风格是 [-]d.dddE±dd
指数包含至少两个数字,只有在必要时才会使用更多的位数。如果值为 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">0</span></span></span> ,指数也是 <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span>. 精度 指定了小数点之后出现的数字的最小数目。默认精度是 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">6</span></span></span>. 如果想要实现不是浮点数也要显示小数点, 可以使用这种代替的解决方法 . 对于无限小数和非数字的转换风格, 请看说明. <span style="color:red">(最后一句英文比较绕口, 不知翻译的对不对)</span> </p>
a
A
<dl> <dd> 将一个浮点数转换为十六进制的指数记数法(科学计数法)。 </dd> </dl> <p> 如果转换修饰符是小写 a , 那么转换风格为 [-]0xh.hhhp±d
如果转换修饰符是大写 A , 那么转换风格为 [-]0Xh.hhhP±d
如果参数不是一个正常的浮点数, 那么第一个十六进制的数字是 0 如果值为 <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span>, 那么指数也是 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">0</span></span></span>. 精度 指定了小数点之后出现的数字的最小数目。默认精度是 足够精确的值表示. 如果想要实现不是浮点数也要显示小数点, 可以使用这种代替的解决方法 . 对于无限小数和非数字的转换风格, 请看说明. <span style="color:red">(最后一句英文比较绕口, 不知翻译的对不对)</span> </p>
g
G
<dl> <dd> 根据一个 浮点数 的值和精度将其转换为十进制或者十进制指数表示法(科学计数法). </dd> </dl> <p> 如果转换修饰符是小写 g 那么转换风格同使用转换修饰符 e 或者 f.
如果转换修饰符是大写 G 那么转换风格同使用转换修饰符 E 或者 F.
假设 P 代表非零精度, 如果未指定精度, 那么精度默认为<span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">6</span></span></span>, 如果精度为 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">0</span></span></span> 那么指定精度为 <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0"> 1</span></span></span>. 然后, 对于指数型转换风格 E 将会有指数 X: </p>
  • 如果 P > X ≥ 4, 转换风格同使用转换修饰符 f 或者 F , 精度为 P 1 X.
  • 否则, 转换风格同使用转换修饰符 e 或者 E, 精度为 P 1.
            总结来说, 就是根据精度不同来确定不同的表现形式.
            <p>
                除非要求 <i>另外的表示形式</i> , 否则最后的 0 将被移除,
                小数点也一样, 如果没有小数部分, 小数点也会被移除.
                对于无限小数和非数字的转换风格, 请看说明.
                <span style="color:red">(最后一句英文比较绕口, 不知翻译的对不对)</span>
            </p>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
    </tr>
    <tr>
        <th>
            <code>n</code>
        </th>
        <td style="text-align: left;">
            <dl>
                <dd>
                    返回自该函数调用开始到目前为止 <b>写入的字符数</b> 。
                    相当于计算printf中的%n之前的所有被输出的字符的长度.
                </dd>
            </dl>
            <p>
                结果将<i>被写入</i>到参数所指定的值中, 该参数为指针类型.
                计算的结果不包含任意的<i>标志字符(flags)</i>, <i>字段宽度(width)</i> 或者 <i>精度</i>.
            </p>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">signed</span>
                        <span class="kw4">char</span><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">short</span><span
                        class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">int</span><span
                        class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span><span
                        class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span> <span
                        class="kw4">long</span><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><a href="http://en.cppreference.com/w/c/types/integer">
                        <span class="kw118">intmax_t</span></a><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    signed <span class="t-c"><span class="mw-geshi c source-c"><a href="http://en.cppreference.com/w/c/types/size_t">
                        <span class="kw100">size_t</span></a><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><a href="http://en.cppreference.com/w/c/types/ptrdiff_t">
                        <span class="kw101">ptrdiff_t</span></a><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
    </tr>
    <tr>
        <th>
            <code>p</code>
        </th>
        <td style="text-align: left;">
            将输出一个<b>指针</b>所指向的内容.输出形式为指针地址形式(0x......)
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td>
            <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">void</span><span
                class="sy2">*</span></span></span>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
    </tr>
</tbody>
ble>

小练习

说了这么多, 看的头晕脑胀口干舌燥, 上个代码爽一下!

/*************************************************************************
    > 文件名: printf.c
    > 作者: 花心胡萝卜
    > 邮箱: hxhlb@hxcarrot.com 
    > 创建时间: 2016-09-08 19:27:34
 ************************************************************************/

#include <stdio.h>

int main() {
    
    // 输出%
    printf("输出[%%].....\n");
    // 使用%c
    printf("使用[%%c]输出一个字符H: [%c].....\n", 'H');
    // 使用%s
    printf("使用[%%s]输出一句话 http://www.hxhlb.net: [%s].....\n", "http://www.hxhlb.net");
    // 使用%d
    printf("使用[%%d]输出一个整数2: [%d].....\n", 2);
    // 使用%o
    printf("使用[%%0o]输出一个十进制数字8: [%0o].....\n", 8);
    // 使用%x %X
    printf("使用[%%0x]和[%%0X]输出一个十进制数字16: [%0x], [%0X].....\n", 16, 16);
    // 使用%u
    printf("使用[%%u]输出一个十进制正数5: [%u].....\n", 5);
    // 使用%f %F
    printf("使用[%%08.4f]和[%%08.4F]输出一个浮点数2.5: [%05.4f], [%05.4F].....\n", 2.5f, 2.5f);
    // 使用%e %E
    printf("使用[%%e]和[%%E]输出一个浮点数20.58901: [%e], [%E].....\n", 20.58901f, 20.58901f);
    // 使用%a %A
    printf("使用[%%a]和[%%A]输出一个浮点数20.58901: [%a], [%A].....\n", 20.58901f, 20.58901f);
    // 使用%g %G
    printf("使用[%%.6g]和[%%.6G]输出一个浮点数2058901.21200: [%g], [%G].....\n", 
            2058901.21200, 2058901.21200);
    printf("使用[%%g]和[%%G]输出一个浮点数20.5800: [%g], [%G].....\n", 20.5800f, 20.5800f);
    // 使用%n
    // 添加这句使%n可用
    _set_printf_count_output(1);
    int iCount = 0;
    printf("使用[%%n]输出当前打印的字符数量,_数一数我有几个字^_^[%n]...\n", &iCount);
    printf("猜对了吗?一共[%d]个数(一个汉字占2位数哦~~不知道为毛).....\n", iCount);
    // 使用%p
    int* pVal = (int*)malloc(sizeof(int));
    *pVal = 5;
    printf("使用[%%p]输出一个指针: 值是:[%d], 指针是:[%p], 指针的指针是:[%p]...\n", *pVal, pVal, &pVal);

    return 0;
}

运行效果图如下:

Alt printf

网站引用原文

以下内容引用自 http://en.cppreference.com/w/c/io/fprintf

Parameters
stream - output file stream to write to 
buffer - pointer to a character string to write to 
bufsz - up to bufsz - 1 characters may be written, plus the null terminator 
format - pointer to a null-terminated multibyte string specifying how to interpret the data. 
    The format string consists of ordinary multibyte characters (except %), which are copied unchanged into the output stream, 
    and conversion specifications. Each conversion specification has the following format: 
        · introductory % character 
        · (optional) one or more flags that modify the behavior of the conversion: 
            · -: the result of the conversion is left-justified within the field (by default it is right-justified) 
            · +: the sign of signed conversions is always prepended to the result of the conversion (by default the result is preceded by minus only when it is negative) 
            · space: if the result of a signed conversion does not start with a sign character, or is empty, space is prepended to the result. It is ignored if + flag is present. 
            · #: alternative form of the conversion is performed. See the table below for exact effects otherwise the behavior is undefined. 
            · 0: for integer and floating point number conversions, leading zeros are used to pad the field instead of space characters. 
                    For integer numbers it is ignored if the precision is explicitly specified. For other conversions using this flag results in undefined behavior. It is ignored if - flag is present. 
        · (optional) integer value or * that specifies minimum field width. The result is padded with space characters (by default), if required, on the left when right-justified, or on the right if left-justified. 
                In the case when * is used, the width is specified by an additional argument of type int. If the value of the argument is negative, it results with the - flag specified and positive field width. 
                (Note: This is the minimum width: The value is never truncated.) 
        · (optional) . followed by integer number or *, or neither that specifies precision of the conversion. In the case when * is used, the precision is specified by an additional argument of type int. 
                If the value of this argument is negative, it is ignored. If neither a number nor * is used, the precision is taken as zero. See the table below for exact effects of precision. 
        · (optional) length modifier that specifies the size of the argument 
        · conversion format specifier 

<style type="text/css">

.wikitable {
    background-color:rgb(249, 249, 249);
    border-bottom-color:rgb(170, 170, 170);
    border-bottom-style:solid;
    border-bottom-width:1px;
    border-collapse:collapse;
    border-image-outset:0px;
    border-image-repeat:stretch;
    border-image-slice:100%;
    border-image-source:none;
    border-image-width:1;
    border-left-color:rgb(170, 170, 170);
    border-left-style:solid;
    border-left-width:1px;
    border-right-color:rgb(170, 170, 170);
    border-right-style:solid;
    border-right-width:1px;
    border-top-color:rgb(170, 170, 170);
    border-top-style:solid;
    border-top-width:1px;
    color:rgb(0, 0, 0);
    direction:ltr;
    display:table;
    font-family:DejaVuSans, "DejaVu Sans", arial, sans-serif;
    font-size:12px;
    height:1894px;
    line-height:15.36px;
    margin-bottom:12px;
    margin-left:0px;
    margin-right:0px;
    margin-top:12px;
    max-width:1080px;
    text-align:center;
    width:675px;
    -webkit-border-horizontal-spacing:2px;
    -webkit-border-vertical-spacing:2px;
}
.kw4 {
    border-collapse:collapse;
    color:rgb(0, 0, 255);
    direction:ltr;
    display:inline;
    font-family:DejaVuSansMono, "DejaVu Sans Mono", courier, monospace;
    font-size:12px;
    height:auto;
    line-height:normal;
    text-align:left;
    white-space:nowrap;
    width:auto;
}
.nu0 {
    border-collapse:collapse;
    color:rgb(0, 0, 128);
    direction:ltr;
    display:inline;
    font-family:DejaVuSansMono, "DejaVu Sans Mono", courier, monospace;
    font-size:12px;
    height:auto;
    line-height:normal;
    text-align:left;
    white-space:nowrap;
    width:auto;
}
.mw-geshi .c .source-c {
    border-collapse:collapse;
    color:rgb(0, 0, 0);
    direction:ltr;
    display:inline;
    font-family:DejaVuSansMono, "DejaVu Sans Mono", courier, monospace;
    font-size:12px;
    height:auto;
    line-height:normal;
    text-align:left;
    white-space:nowrap;
    width:auto;
}

</style>

<td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle; text-align: center;"> N/A
Conversion
specifier
Explanation Argument type
length modifier hh h (none) l ll j z t L
% writes literal %. The full conversion specification must be %%.
c <dl> <dd> writes a single character. </dd> </dl> <p> The argument is first converted to <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw4">unsigned</span> <span class="kw4">char</span></span></span>. If the l modifier is used, the argument is first converted to a character string as if by %ls with a <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw4">wchar_t</span><span class="br0">[</span><span class="nu0">2</span><span class="br0">]</span></span></span> argument. </p> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">int</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c">wint_t</span></span></div> </div>
s <dl> <dd> writes a character string </dd> </dl> <p> The argument must be a pointer to the initial element of an array of characters. Precision specifies the maximum number of bytes to be written. If Precision is not specified, writes every byte up to and not including the first null terminator. If the l specifier is used, the argument must be a pointer to the initial element of an array of <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">wchar_t</span></span></span>, which is converted to char array as if by a call to <span class="t-lc"> wcrtomb</span> with zero-initialized conversion state. </p> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">char</span><span class="sy2">*</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">wchar_t</span><span class="sy2">*</span></span></span></div> </div>
d
i
<dl> <dd> converts a signed integer into decimal representation [-]dddd. </dd> </dl> <p> Precision specifies the minimum number of digits to appear. The default precision is <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span>.
If both the converted value and the precision are <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span> the conversion results in no characters. </p>
<div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">signed</span> <span class="kw4">char</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">short</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">int</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span> <span class="kw4">long</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw118">intmax_t</span></span></span></div> </div> <div class="t-vertical"> <div> signed <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw100">size_t</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw101">ptrdiff_t</span></span></span></div> </div>
o <dl> <dd> converts a unsigned integer into octal representation oooo. </dd> </dl> <p> Precision specifies the minimum number of digits to appear. The default precision is <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span>. If both the converted value and the precision are <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span> the conversion results in no characters. In the alternative implementation precision is increased if necessary, to write one leading zero. In that case if both the converted value and the precision are <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">0</span></span></span>, single <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">0</span></span></span> is written. </p> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">char</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">short</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">int</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">long</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">long</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw132">uintmax_t</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw100">size_t</span></span></span></div> </div> <div class="t-vertical"> <div> unsigned version of <span class="t-c"><span class="mw-geshi c source-c"> <span class="kw101">ptrdiff_t</span></span></span></div> </div>
x
X
<dl> <dd> converts an unsigned integer into hexadecimal representation hhhh. </dd> </dl> <p> For the x conversion letters abcdef are used.
For the X conversion letters ABCDEF are used.
Precision specifies the minimum number of digits to appear. The default precision is <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span>. If both the converted value and the precision are <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span> the conversion results in no characters. In the alternative implementation 0x or 0X is prefixed to results if the converted value is nonzero. </p>
u <dl> <dd> converts an unsigned integer into decimal representation dddd. </dd> </dl> <p> Precision specifies the minimum number of digits to appear. The default precision is <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span>. If both the converted value and the precision are <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span> the conversion results in no characters. </p>
f
F
<dl> <dd> converts floating-point number to the decimal notation in the style [-]ddd.ddd. </dd> </dl> <p> Precision specifies the minimum number of digits to appear after the decimal point character. The default precision is <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">6</span></span></span>. In the alternative implementation decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. </p> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">double</span></span></span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">double</span></span></span> <span class="t-mark-rev t-since-c99">(since C99)</span></div> </div> <div class="t-vertical"> <div> <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span> <span class="kw4">double</span></span></span></div> </div>
e
E
<dl> <dd> converts floating-point number to the decimal exponent notation. </dd> </dl> <p> For the e conversion style [-]d.ddde±dd is used.
For the E conversion style [-]d.dddE±dd is used.
The exponent contains at least two digits, more digits are used only if necessary. If the value is <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0"> 0</span></span></span>, the exponent is also <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span>. Precision specifies the minimum number of digits to appear after the decimal point character. The default precision is <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">6</span></span></span>. In the alternative implementation decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. </p>
a
A
<dl> <dd> converts floating-point number to the hexadecimal exponent notation. </dd> </dl> <p> For the a conversion style [-]0xh.hhhp±d is used.
For the A conversion style [-]0Xh.hhhP±d is used.
The first hexadecimal digit is 0 if the argument is not a normalized floating point value. If the value is <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">0</span></span></span>, the exponent is also <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">0</span></span></span>. Precision specifies the minimum number of digits to appear after the decimal point character. The default precision is sufficient for exact representation of the value. In the alternative implementation decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. </p>
g
G
<dl> <dd> converts floating-point number to decimal or decimal exponent notation depending on the value and the precision. </dd> </dl> <p> For the g conversion style conversion with style e or f will be performed.
For the G conversion style conversion with style E or F will be performed.
Let P equal the precision if nonzero, <span class="t-c"><span class="mw-geshi c source-c"> <span class="nu0">6</span></span></span> if the precision is not specified, or <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0">1</span></span></span> if the precision is <span class="t-c"><span class="mw-geshi c source-c"><span class="nu0"> 0</span></span></span>. Then, if a conversion with style E would have an exponent of X: </p>
  • if P > X ≥ 4, the conversion is with style f or F and precision P 1 X.
  • otherwise, the conversion is with style e or E and precision P 1.
            <p>
                Unless <i>alternative representation</i> is requested the trailing zeros are removed,
                also the decimal point character is removed if no fractional part is left. For infinity
                and not-a-number conversion style see notes.
            </p>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
    </tr>
    <tr>
        <th>
            <code>n</code>
        </th>
        <td style="text-align: left;">
            <dl>
                <dd>
                    returns the <b>number of characters written</b> so far by this call to the function.
                </dd>
            </dl>
            <p>
                The result is <i>written</i> to the value pointed to by the argument. The specification
                may not contain any <i>flag</i>, <i>field width</i>, or <i>precision</i>.
            </p>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">signed</span>
                        <span class="kw4">char</span><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">short</span><span
                        class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">int</span><span
                        class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span><span
                        class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">long</span> <span
                        class="kw4">long</span><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><a href="http://en.cppreference.com/w/c/types/integer">
                        <span class="kw118">intmax_t</span></a><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    signed <span class="t-c"><span class="mw-geshi c source-c"><a href="http://en.cppreference.com/w/c/types/size_t">
                        <span class="kw100">size_t</span></a><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td>
            <div class="t-vertical">
                <div>
                    <span class="t-c"><span class="mw-geshi c source-c"><a href="http://en.cppreference.com/w/c/types/ptrdiff_t">
                        <span class="kw101">ptrdiff_t</span></a><span class="sy2">*</span></span></span></div>
            </div>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
    </tr>
    <tr>
        <th>
            <code>p</code>
        </th>
        <td style="text-align: left;">
            writes an implementation defined character sequence defining a <b>pointer</b>.
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td>
            <span class="t-c"><span class="mw-geshi c source-c"><span class="kw4">void</span><span
                class="sy2">*</span></span></span>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
        <td class="table-na" style="background: #ececec; color: grey; vertical-align: middle;
            text-align: center;">
            <small>N/A</small>
        </td>
    </tr>
</tbody>
ble>

如有错误,请提出指正!谢谢.

回复