# include <stdio.h>
# include <stdlib.h>
int main ()
{
int num_int = 435;
double num_double = 435.50f;
char str_int[30];
char str_double[30];
////////////////////////////////////////////////
int num_int2;
double num_double2;
char str_int2[30] = "435"; //将要被转换为整型的字符串
char str_double2[30] = "436.55"; //将要被转换为浮点型的字符串
/////////////////////////////////////////////////////////////////////
itoa(num_int, str_int, 10); //把整数num_int转成字符串str_int,10表示按十进制转换;
gcvt(num_double, 5, str_double); //把浮点数num_double转成字符串str_double
printf("str_int: %s\n", str_int);
printf("str_double: %s\n", str_double);
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载