CString str1;
int int1=1;
str1.Format("%i",int1);
int int1=1;
str1.Format("%i",int1);
解决方案 »
- 控制台访问程序错误。。求解。。
- 急,急,关于VS2005软件打包的问题,请教大家!!
- Opengl 光照 为什么有的物体有光照,有的没有呢?
- 自己写了两个个程序,有一个功能完全相同(代码也相同)但是运行出的结果是两种,想了很长时间自己有个猜测请大家指点一下!
- [IWebBrowser2问题] 请教蒋晟及各位老大!!
- 弱智问题。想保存csdn里面论坛的帖子。可是另存为不管用。咋办呀。
- 100分求C++捉虫历险记。
- 请问vc里面用什么函数创建文件,以及如何将一个char[6]里面存储的6位数字(中间有小数点,而且小数点位置不固定)转换成int
- DLL问题,高手帮个忙?急
- 为什么串口有时可以收发,有时只能发不能收.
- 如何产生随机数?请举例产生介于1与10之间的随机数的代码?
- 怎样给用户显示一个倒计时器,例如象联众里得出牌时间那样的?
* as strings can be converted to numeric values
* using the atof, atoi, and atol functions.
*/#include <stdlib.h>
#include <stdio.h>void main( void )
{
char *s; double x; int i; long l; s = " -2309.12E-15"; /* Test of atof */
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x ); s = "7.8912654773d210"; /* Test of atof */
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x ); s = " -9885 pigs"; /* Test of atoi */
i = atoi( s );
printf( "atoi test: ASCII string: %s\t\tinteger: %d\n", s, i ); s = "98854 dollars"; /* Test of atol */
l = atol( s );
printf( "atol test: ASCII string: %s\t\tlong: %ld\n", s, l );
}
Outputatof test: ASCII string: -2309.12E-15 float: -2.309120e-012
atof test: ASCII string: 7.8912654773d210 float: 7.891265e+210
atoi test: ASCII string: -9885 pigs integer: -9885
atol test: ASCII string: 98854 dollars long: 98854
int int1=1;
str1.Format("%d",int1);
也成
char buf[10];
CString NewText(_itoa(x,buf,10));
//10是代表10进制的意思,凭记忆写的,可能有错,见谅
int a=120012;
str.Format("%d",a);