请输入您要查询的百科知识:

 

词条 _set_output_format
释义

C语言函数_set_output_format简介

函数原型: unsigned int _set_output_format( unsigned int format);

所属库: stdio.h

函数功能: 按指定的格式输出。

返回值: 返回之前的输出格式。

相关函数: _get_output_format、_set_printf_count_output

IDE: VS系列

程序示例

下面这段代码来自MSDN

#include <stdio.h>

void printvalues(double x, double y)

{

printf("%11.4e %11.4e\", x, y);

printf("%11.4E %11.4E\", x, y);

printf("%11.4g %11.4g\", x, y);

printf("%11.4G %11.4G\", x, y);

putchar('\');

}

int main()

{

double x = 1.211E-5;

double y = 2.3056E-112;

unsigned int old_exponent_format;

printvalues(x, y);

old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);

printvalues(x, y);

_set_output_format( old_exponent_format );

printvalues(x, y);

return 0;

}

输出:

1.2110e-005 2.3056e-112

1.2110E-005 2.3056E-112

1.211e-005 2.306e-112

1.211E-005 2.306E-112

1.2110e-05 2.3056e-112

1.2110E-05 2.3056E-112

1.211e-05 2.306e-112

1.211E-05 2.306E-112

1.2110e-005 2.3056e-112

1.2110E-005 2.3056E-112

1.211e-005 2.306e-112

1.211E-005 2.306E-112

请按任意键继续. . .

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/2/26 23:49:34