1.数字转字符串
#include<stdlib.h>
#include<stdio.h>
int main()
{
int number=16;
char string[25]="";
sprintf(string, "%06d", number);
printf("integer=%dstring=%s\n",number,string);
return 0;
}
2.字符串转换数字
atoi
atof
3.浮点数等需要注意进行比较的时候需要在一定的精度内比较,不用用==来比较
参考:
http://www.uml.org.cn/c++/200908315.asp C++中的数据类型转换方法
http://blog.sina.com.cn/s/blog_4c8a2a870100qgq7.html
http://sealbird.iteye.com/blog/866701
http://blog.itpub.net/14766028/viewspace-703264/
http://www.cnblogs.com/lidabo/archive/2012/07/10/2584706.html
http://www.jb51.net/article/36935.htm 转换过程中精度的问题

283

被折叠的 条评论
为什么被折叠?



