I am working on a homework assignment where I had to convert all of the static arrays in a program into dynamic arrays using pointers. I am pretty sure I am understanding the concept, I have made the changes and my program runs. The problem is with my output results. I suspect I am inputting the data incorrectly from the file I am using. Here is a pic of my issue as well as relevent code:

EDITS FROM 9/21 AFTER THIS POINT:

**Output & Data file:**
![enter image description here](https://i.stack.imgur.com/qLsEh.png)

**main** 

```
#include "Ch9_Ex7.h"

int main()
{
    int numCandidates;
    string *allCandidates;
    int *votes;
    int index, totalVotes;
    ifstream infile;

    allCandidates = new string[1];
    votes = new int[1];

    infile.open("./Ch9_Ex7Data.txt");
    if (!infile)
    {
        cerr << "Cannot open input file. Program terminates!" << endl;
        return 1;
    }

// read number of candidates

    readVotes (infile, votes, allCandidates, numCandidates);

    //delete [] votes;
    //delete [] allCandidates;

```

**Input Function:**

```
#include "Ch9_Ex7.h"

void readVotes (ifstream & infile, int *&votes,
                string *&allCandidates, int & numCandidates)
{

//    read number of candidates
    infile >> numCandidates;
    infile.ignore();  // carriage return

    //delete [] votes;
    //delete [] allCandidates;

    allCandidates = new string[numCandidates];
    votes = new int[numCandidates];

    for (int index = 0; index < numCandidates; index++)
    {
        infile >> votes[index];
        infile.ignore();  // space
        getline(infile, allCandidates[index]);
    }

}

```