I'm working on an assignment to assign students names and their grades to an array and find the average grade. I can't seem to get any cout statements to display after the while loop. I've been banging my head against a wall for a while so any help would be great. Probably something obvious I'm just missing. Worth the txt file has both names and their scores.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
    //Variables
    ifstream inFile;
    ofstream outFile;
    inFile.open("data7.txt");
    outFile.open("Results.txt");
    int quantity = 0;
    int sum = 0;
    int x = 0;
    double avg = 0;
    double grade[MAX];
    double gradeInput;
    string name[MAX];
    string nameInput;
    //Checks if file is found
    if (!inFile)
    {
        cout << "Error finding input file\n";       
    }
    while (!inFile.eof())
    {
        x++;
        getline(inFile, nameInput);
        inFile >> gradeInput;
        name[x] = nameInput;
        grade[x] = gradeInput;
    }
    for (int i = 0; x > i;)
    {
        i++;
        inFile >> sum;
        avg = avg + sum;
        avg = avg / i;  
    }
    cout << "Enter quantity of grades to be processed (0 - , " << x << ", ):";
    cin >> quantity;
