c++ stdlib.h內有原生的函數:數字字符串互轉
//字符串轉數字
int i = atoi("66");
printf("%d",i);
double f =atof("2013.14");
printf("%lf",f);
//數字轉字符串
char str[64];
itoa(666,str,10);
printf(str);//666
gcvt(3.1415926,10,str);//第二個參數爲轉字符串長度不包含小數點
printf(str);//3.1415926
c++ stdlib.h內有原生的函數:數字字符串互轉
//字符串轉數字
int i = atoi("66");
printf("%d",i);
double f =atof("2013.14");
printf("%lf",f);
//數字轉字符串
char str[64];
itoa(666,str,10);
printf(str);//666
gcvt(3.1415926,10,str);//第二個參數爲轉字符串長度不包含小數點
printf(str);//3.1415926