I am making a program that will read from a file and output the data both on screen and in a file. I had it working prior to adding an Overall Average and Total Count, but now it just crashes with no errors in the compliling process.
I have searched similar threads, but am unable to find anything that helps me fix these errors. Any assistance is appreciated.
Edit: updated teh code with some of the changes suggested. Now just crashing w/ no errors.
                          #include <iostream>
            #include <string>
            #include <limits>
            #include <cmath>
            #include <iomanip>
            #include <fstream>
            using namespace std;
            void gradeCalc(int studentID, int count, double midterm, double finalExam, double researchPaper, double groupProject, double participation, double studentAvg, double& overallAvg, double gradeSum);
            void printGrade(int studentID, int count, double midterm, double finalExam, double researchPaper, double groupProject, double participation, double studentAvg, double& overallAvg, double gradeSum);
            int main()
            {
                int studentID;
                int count = 0;
                double midterm;
                double finalExam;
                double researchPaper;
                double groupProject;
                double participation;
                double studentAvg;
                double overallAvg;
                double gradeSum;
                gradeCalc(studentID, count, midterm, finalExam, researchPaper, groupProject, participation, studentAvg, overallAvg, gradeSum);
                printGrade(studentID, count, midterm, finalExam, researchPaper, groupProject, participation, studentAvg, overallAvg, gradeSum);
                return 0;
            }
            void printGrade(int studentID, int count, double midterm, double finalExam, double researchPaper, double groupProject, double participation, double studentAvg, double& overallAvg, double gradeSum)
            {
                ifstream infile;
                ofstream outfile;
                infile.open("grades.dat");
                outfile.open("grades.txt");
                outfile << "STUDENT GRADING REPORT: ";
                outfile << fixed << showpoint << setprecision(2);
                while (!infile.eof()) {
                    infile >> studentID >> midterm >> finalExam >> researchPaper >> groupProject >> participation;
                    if (studentID > 1 && studentID <= 999) {
                        outfile << endl
                                << "Student ID: " << studentID << ' ' << "Midterm: " << midterm << ' ' << "Final Exam: " << finalExam << ' ' << "Research Paper: " << researchPaper << ' ' << "Group Project: " << groupProject
                                << "Participation: " << participation << ' ' << "Student Average: " << studentAvg;
                    }
                    overallAvg = gradeSum / count;
                    outfile << endl
                            << "Total # of Students: " << count
                            << "Overall Class Average: " << overallAvg;
                }
                infile.close();
                outfile.close();
            };
            void gradeCalc(int studentID, int count, double midterm, double finalExam, double researchPaper, double groupProject, double participation, double studentAvg, double& overallAvg, double gradeSum)
            {
                //midterm = .25
                //finalExam = .25
                //researchPaper = .20
                //groupProject = .20
                //participation = .10
                ifstream infile;
                ofstream outfile;
                infile.open("grades.dat");
                while (!infile.eof()) {
                    infile >> studentID >> midterm >> finalExam >> researchPaper >> groupProject >> participation;
                    studentAvg = ((midterm * .25) + (finalExam * .25) + (researchPaper * .20) + (groupProject * .20) + (participation * .10));
                    overallAvg = gradeSum / count;
                    if (studentID > 1 && studentID <= 999) {
                        count++;
                        gradeSum += studentAvg;
                        cout << endl
                             << fixed << showpoint << setprecision(2) << "Student ID: " << studentID << ' ' << "Average:  " << studentAvg;
                    }
                    cout << endl
                         << "Total # of Students: " << count
                         << "Overall Class Average: " << overallAvg;
                }
                infile.close();
            };
 
     
     
    