I am creating a random number generator that saves Min, Max, Avg, random numbers and bubblesorted numbers to an excel file when I came across a few errors, for some reason I am unable to call this a function from c++ MFC as shown directly below, How can I make this work?

```
//***************Number generator function*******************
void number_Generator(double dblArray[], int length)
{
    srand((unsigned)time(0));
    double rndDbl;
    int rndInt;
    double rndAvg = 0;
    int counter = 0;
    double temp = 0;

    Final_Avg = rndAvg / counter; // final average to display
    double lDbl=0, hDbl=Random_Cap; 
    int lInt = 0, hInt=1;

    double dblRange=(hDbl-lDbl)+1;
    int intRange=(hInt-lInt)+1;

    for(int index=0; index<Samples_To_Create; index++) 
    {
        rndInt = lInt+int(intRange*rand()/(RAND_MAX + 1.0));
        rndDbl = lDbl+double(dblRange*rand()/(RAND_MAX + 1.0));

        // random number if statement
        if (rndInt == 0){
            rndDbl = -(rndDbl);
        }

        //start of Min/Max if statements
        if (rndMin == 0){
            rndMin = rndDbl;
        }
        else if (rndDbl < rndMin){
            rndMin = rndDbl;
        }

        if (rndMax == 0){
            rndMax = rndDbl;
        }
        else if (rndDbl > rndMax){
            rndMax = rndDbl;
        } //end of Min Max if statements

        temp = rndDbl;
        rndAvg += temp;
        dblArray[counter] = temp;
        counter++;
        }

    }
}

```

It's being called from a button click handler:

```
void CECET_MFC_Dialog_Based_IntroDlg::OnBnClickedCreate()
{
    UpdateData(true);

    number_Generator(dblArray, 100); //100 means generate 100 random numbers

    UpdateData(false);
}

```

The public access variables are coming up as undeclared identifier, even though they are defined as shown below. 

```
CECET_MFC_Dialog_Based_IntroDlg::CECET_344_MFC_Dialog_Based_IntroDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CECET_344_MFC_Dialog_Based_IntroDlg::IDD, pParent)
, Final_Avg(0)
, rndMax(0)
, rndMin(0)
, Samples_To_Create(0)
, Random_Cap(0)
{
    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CECET_MFC_Dialog_Based_IntroDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Text(pDX, IDC_EDIT3, Final_Avg);
    DDX_Text(pDX, IDC_EDIT4, rndMax);
    DDX_Text(pDX, IDC_EDIT5, rndMin);
    DDX_Text(pDX, IDC_EDIT2, Samples_To_Create);
    DDX_Text(pDX, IDC_EDIT1, Random_Cap);
}

```