#include <stdio.h>//sprintf
#include <stdlib.h>//atof,atol,strtod,strtol
using namespace std;
int main(){
//字符串转数值
printf("%f
", atof("23"));//23.000000
printf("%d
", atol("23"));//23
printf("%f
", strtod("23.00", NULL));//23
printf("%d
", strtol("23.00$$$$", NULL, 10));//23
//数值转字符串
char tmp[10];
int i = 67;
sprintf(tmp, "%d", 89);//将数值转字符串
printf("%s
", tmp);//89
sscanf( tmp, "%d", &i ); // 将字符串转换成整数 i = 15
printf("%s-%d
", tmp, i);//89-89
}