I've been stuck on this homework question for a couple of days now. I did some research and I got to this:
#include<iostream>
#include<fstream>
#include<string>
#include<array>
using namespace std;
const int MAX_SIZE = 100;
bool RepeatCheck(int storage[], int size, int checker);
int main()
{
    ifstream input("input.txt");
    if (!input) // if input file can't be opened
    {
        cout << "Can't open the input file successfuly." << endl;
        return 1;
    }
    int storage[MAX_SIZE];
    int inputCount;
    int checker;
    while (!input.eof())
    {
        for (int i = 0; i <= MAX_SIZE; i++)
        {
            input >> checker;
            if (!RepeatCheck(storage, MAX_SIZE, checker))
            {
                input >> storage[i];
            }
        }
    }
    // print array
    for (int i = 0; i < 100; i++)
    {
        cout << storage[i] << " ";
    }
    return 0;
}
bool RepeatCheck(int storage[], int size, int checker)
{
    for (int i = 0; i <= MAX_SIZE; i++)
    {
        if (storage[i] == checker)
        {
            return false;
        }
    }
}
My input file needs to be filled with integers separated by white space or on new lines:
1 2 2 3 5 6 5 4 3 20 34 5 7 5 2 4 6 3 3 4 5 7 6 7 8
I need to read the integers from the file and store them in the storage[] array only if they aren't already in the array.
It's not doing what I need it to do. Please take a look at my code and tell me where the logic error is. Much appreciated.
 
    