CString a("100"),b("2");
if(atoi(a)>atoi(b))

解决方案 »

  1.   

    我觉得不需转换成numeric值直接比较应该也是可行的。
    >,<,== or
    str1.Compare(str2);
      

  2.   

    please notice thisCString::Compare
    int Compare( LPCTSTR lpsz ) const;Return ValueZero if the strings are identical, < 0 if this CString object is less than lpsz, or > 0 if this CString object is greater than lpsz.
      

  3.   

    To:white_whan(white)
    不转换成数值直接比较会出问题,如:
    "-12"> "-11",但-12 < -11。
      

  4.   

    如果是负数,不转化也可以,判断一下string的第一个char分别做处理就可以了
    12.000000的问题就繁了一些