我将一个实数转化为字符串,先寻求一个将此字符串再转化为实数的函数,并附带参数说明

解决方案 »

  1.   

    double atof( const char *string );
    int atoi( const char *string );
    _int64 _atoi64( const char *string );
    long atol( const char *string );  atoi, atol, atof, 这些都是 C 的函数库
      

  2.   

    double atof( const char *string );
    e.g.
       s = "7.8912654773d210";  /* Test of atof */
       x = atof( s );
       printf( "atof test: ASCII string: %s\tfloat:  %e\n", s, x );
      

  3.   

    double atof( const char *string );
    e.g.
       s = "7.8912654773d210";  /* Test of atof */
       x = atof( s );
       printf( "atof test: ASCII string: %s\tfloat:  %e\n", s, x );
      

  4.   

    double atof( const char *string );
    e.g.
       s = "7.8912654773d210"; 
       x = atof( s );
       printf( "atof test: ASCII string: %s\tfloat:  %e\n", s, x );
      

  5.   

    CString str = "3.14159";
    float PI = atof( str );
      

  6.   

    CString str = "3.1415926";
    方法一:
     double d = atof( str )// include <math.h>
    方法二:
     double d;
     sscanf( str, "%f", &d );
      

  7.   

    很简单!使用atof()即可转换为浮点数;
    使用sprinf()或者CString类的Format()函数都可以转换为字符串形式;如何?