I was wondering if anyone could help me with my code (C++)? This is the function that will not work. When I run it, Windows pops up and says "This program has stopped working." Here is the code that will not run (it's a little long, but the program is proprietary and I appreciate any help):
void ClassName::loadGrades(){
    string temp;
    int count=0;
    ifstream labErnIn("labGradesErn.txt");
    if(labErnIn.is_open()){
        count=0;
        while(labErnIn.good()){
            getline(labErnIn, temp);
            float tempF = ::atof(temp.c_str());
            labGradesErn[count] = tempF;
            if(labGradesErn[count]==0 && count==0) labGradesErn[count]=-1;
            count++;
        }
        labGradesErn[count-1]=-1;
        labErnIn.close();
    }
    else{
        cout << "Unable to open file labGradesErn.txt" << endl;
    }
    // I repeat this for three other sections, same code, different var names.
    // From 'ifstream...' to 'Unable to open file'
}
All variables not declared in this function are declared elsewhere.
Thanks, I really appreciate any and all help!
 
    