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

 

词条 fcvt
释义

§ 解释

函数名: fcvt

功 能: 把一个浮点数转换为字符串

用 法: char *fcvt(double value, int ndigit, int *decpt, int *sign);

§ 程序例

#include <stdlib.h>

#include <stdio.h>

#include <conio.h>

int main(void)

{

char *string;

double value;

int dec, sign;

int ndig = 10;

clrscr();

value = 9.876;

string = ecvt(value, ndig, &dec, &sign);

printf("string = %s     dec = %d \\

sign = %d\", string, dec, sign);

value = -123.45;

ndig= 15;

string = ecvt(value,ndig,&dec,&sign);

printf("string = %s dec = %d sign = %d\",

string, dec, sign);

value = 0.6789e5; /* scientific

notation */

ndig = 5;

string = ecvt(value,ndig,&dec,&sign);

printf("string = %s        dec = %d\\

sign = %d\", string, dec, sign);

return 0;

}

随便看

 

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

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2024/11/14 15:27:58