I'm still fairly new to programming and I'm a little confused as to how to get this to work. I want to loop through all Years in the Array and if it is not found, I want to print out an error message and prompt the user to try again. I've tried doing an else statement but it keeps repeating the error message until the year is found. Any suggestions?

```
void option2(Vector<WindLogType> &windlog)
{

    int month = 0;
    int year;
    const int SIZE = windlog.size();
    float *averagetemp = new float[SIZE];
    float *sd = new float[SIZE];
    float *sum = new float[SIZE];
    float *sigma = new float[SIZE];
    float *nrofel = new float[SIZE];
    int *check = new int[SIZE];
    int counter = 0;
    int yearCheck = 0;

        while(yearCheck==0){
            cout << "Please enter a year: " << endl;
            cin >> year;

            for(int i = 0; i < SIZE; i++)
            {

                if(windlog[i].d.GetYear() == year)
                {

                    month = windlog[i].d.GetMonth();
                    counter = month;
                    nrofel[counter] = nrofel[counter] + 1;
                    sum[counter] += windlog[i].temp.GetTemperature();
                    averagetemp[counter] = (sum[counter]/nrofel[counter]);
                    sigma[counter] += (windlog[i].temp.GetTemperature() - averagetemp[counter])*(windlog[i].temp.GetTemperature() - averagetemp[counter]);
                    sd[counter] = sqrt((sigma[counter])/(nrofel[counter] - 1));
                    check[counter] = 1;

                }

            }
            for(int start = 1; start < 13; start++)
            {

            if(check[start] == 1)
            {
                cout << checkMonth(start) << ": " << averagetemp[start] << " degrees C, stdev: " << sd[start] << '\n';
            }
            else
            {
                cout << checkMonth(start) << ": No Data" << '\n';
            }

            }

            yearCheck = 1;

        }

        delete[] averagetemp;
        delete[] sum;
        delete[] sigma;
        delete[] sd;

}

```