CString 新手问题!!! CString a="1";如何把这个 a 转换成 int 呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 #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-012atof test: ASCII string: 7.8912654773d210 float: 7.891265e+210atoi test: ASCII string: -9885 pigs integer: -9885atol test: ASCII string: 98854 dollars long: 98854 CString str="1000";int intValue=onresultdata1 = atoi((LPTSTR)(LPCTSTR)str); 请教关于GDI+背景图片覆盖按钮和窗口抖动的问题 运行共享文件夹里的程序,是否会占用网络资源? 怎么把int变量的值转换成CString类型的? 新手入门,请教一个简单问题,在线等! 软键盘问题 取得文档指针 绘制波形请教! bmp如何转化为tiff格式! 回车,换行 我要学Linux,怎么转? 非常简单的问题!!!(在线等待) 请各位高手帮忙解决一下啊~~~~
#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 );
}Output
atof 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 intValue=onresultdata1 = atoi((LPTSTR)(LPCTSTR)str);