You are calling the MathContext
constructor-methods directly, change that to to the below
by dropping the first part of MathContext::MathContext
to just MathContext
int main(int argc, _TCHAR* argv[])
{
MathContext context[8];
context[0] = MathContext();
context[1] = MathContext((unsigned short) 46);
context[2] = MathContext((unsigned int) 20);
context[3] = MathContext(MathContext::UP);
context[4] = MathContext((unsigned short) 36, (unsigned int) 30);
context[5] = MathContext((unsigned short) 36, MathContext::HALF_DOWN);
context[6] = MathContext((unsigned int) 25, MathContext::HALF_EVEN);
context[7] = MathContext((unsigned short) 26, (unsigned int) 29, MathContext::HALF_EVEN);
You are deleting memeory which is not allocated (new
ed) by you (remove that)
MathContext::~MathContext(void)
{
//delete &base;
//delete &precision;
//delete &mode;
}
In short, your program was hanging due to the weird memory errors you had — direct invocation of a constructor will assume that memory for the object is already allocated + the deallocation of memory which you had not allocated.
2
solved Unterminating c++ Program [closed]