Code: Select all

```
void _43ProjectFrame::OnRgrButtonClick(wxCommandEvent& event)
{
int n = 0;
const long ASK_ID = wxNewId();
AskSize* ask = new AskSize(this,ASK_ID);
ask->ShowModal();
n = ask->getN();
if (n == 0) return;
currentObject = new Catalan(n);
currentObject->recursiveRandomGenerator();
outputBinaryTree();
}
void _43ProjectFrame::outputBinaryTree(){
wxClientDC* io_area = new wxClientDC(Panel1);
int* width;
int* height;
int n = currentObject->getN();
int index = 0;
Panel1->GetSize(width,height);
if (width == NULL || height == NULL) return;
int widthInc[n];
int widthStart[n];
int heightInc = *height/(n+1);
int heightStart = heightInc/2;
for (int i = 0; i < n; i++){
widthInc[i] = *width/((int)pow(2,i));
widthStart[i] = widthInc[i]/2;
}
wxPoint root(widthStart[0],heightStart);
io_area->DrawPoint(root);
int leftIndex = 2*index+1;
int rightIndex = 2*index+1;
}
```