方法一:
LONGLONG iOpenPrice = LONGLONG(_mthst.openPrice * 100);
LONGLONG iClosePrice = LONGLONG(_mthst.closePrice * 100);
LONGLONG iHighPrice = LONGLONG(_mthst.highPrice * 100);
LONGLONG iLowPrice = LONGLONG(_mthst.lowPrice * 100);
_mthst.openPrice = iOpenPrice / 100.0;
_mthst.closePrice = iClosePrice / 100.0;
_mthst.highPrice = iHighPrice / 100.0;
_mthst.lowPrice = iLowPrice / 100.0;
方法二:
char chPrices[4][32] = {};
sprintf_s(chPrices[0], "%.2f", _mthst.openPrice);
sprintf_s(chPrices[1], "%.2f", _mthst.closePrice);
sprintf_s(chPrices[2], "%.2f", _mthst.highPrice);
sprintf_s(chPrices[3], "%.2f", _mthst.lowPrice);
_mthst.openPrice = atof(chPrices[0]);
_mthst.openPrice = atof(chPrices[1]);
_mthst.openPrice = atof(chPrices[2]);
_mthst.openPrice = atof(chPrices[3]);