Store a .txt file columns into an array in c++
<p>I am new to programming, so I have what is probably a basic question. I currently have a text file with 2 columns. Each line has x and y numbers separated by white spaces. These are the first five lines of the file:</p>

<pre><code>120 466
150 151
164 15
654 515
166 15
</code></pre>

<p>I want to read the data and store them into x and Y columns and then call for the data some where else in the program for eg x[i] and y[i]. Say, I do not know the number of lines. This is the part of my code where I attempt to do just that.</p>

<pre><code>#include &lt;fstream&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;

using namespace std;

int main()
{
    double X[];
    double Y[];

    ifstream inputFile("input.txt");
    string line;

    while (getline(inputFile, line))
    {
        istringstream ss(line);

        double x,y;

        ss &gt;&gt; x &gt;&gt; y;
        X = X + [x];
        Y = Y + [y];

        return 0;
    }
}
</code></pre>