#include #include #include #include using namespace std; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int iDollar = 1; // 1 int iCent = 15; // 15 double dMoney = iDollar + (double)iCent / 100; // 1.15 int iConvDollar = (int)dMoney; // 1 double dCent = fmod(dMoney, 1) * 100; // 15 int iConvCent = (int)dCent; // 14, should be 15 stringstream ssText; ssText << "Int 1 Dollar: " << iDollar << "\r\n" << "Int 15 Cents: " << iCent << "\r\n" << "Double Amount: " << dMoney << "\r\n" << "(int)Double Dollar: " << iConvDollar << "\r\n" << "Double Cents: " << dCent << "\r\n" << "(int)Double Cents: " << iConvCent; string sText(ssText.str()); MessageBoxA(NULL, sText.c_str(), "Flaw", MB_OK); return 0; }