An Introduction to Numerical Methods in C++, Revised Edition

Each application will require a few functions peculiar to itself. In each case we therefore define a class derived from TScreen to contain these functions. In order to draw a function, as we did in 15.2.5, we first include the header file screen.h, then define a function type:
typedef double(*func)(double);
The derived class we take to be:
class TFuncScreen : public TScreen {private: void SetFuncRange();public: TFuncScreen(LPSTR ATitle) : TScreen(NULL, ATitle) { }; void SetScreen(RECT&, func); void DrawFunc(HDC, func, COLORREF); virtual void Paint(HDC PiantDC, PAINTSTRUCT &PaintInfo);};It contains a private function SetFuncRange which, with the aid of an input dialogue box, determines the interval [x1o, xhi], over which the function is to be examined, and hence the values TopLeft.x and BottomRight.x:
void TFuncScreen: :SetFuncRange(){ char Buffer [20]; strcpy(Buffer, " ");<a name="851"></a><a name="page512"></a> float xlo, xhi; if(GetApplication()->ExecDialog (new TInputDialog(this, "Input Interval", "Enter XLO XHI:", Buffer, sizeof(Buffer) ) ) == IDOK) sscanf(Buffer, "%f %f", &xlo, &xhi); TopLeft.x = double(xlo); ...