[Solved] Run-Time Check Failure #2 – Stack around the variable ‘gpa’ was corrupted [closed]


You have an infinite loop – it seems that you got confused about the logic of your inner and outer loop.

It looks like you need to change:

            else
            {
                gpa[x] = 0.00;
            } // end of if/else
        } // end of inner while loop
        finalGpa[x] = (gpa[0] + gpa[1] + gpa[2] + gpa[3]) / 4;
        cout << firstName << " " << lastName << " " << finalGpa[x] << endl;
        x++;
    } // end of outer while loop

to:

            else
            {
                gpa[x] = 0.00;
            } // end of if/else
            finalGpa[x] = (gpa[0] + gpa[1] + gpa[2] + gpa[3]) / 4;
            cout << firstName << " " << lastName << " " << finalGpa[x] << endl;
            x++;
        } // end of inner while loop
    } // end of outer while loop

solved Run-Time Check Failure #2 – Stack around the variable ‘gpa’ was corrupted [closed]