Reading from an input file
<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

int main(int argc, char *argv[]) {
    int size = 0;
    int highNum = 0;
    int m;
    string fname;

    cout &lt;&lt; "Supply the name of the input file you would like to use." &lt;&lt; endl;
    cin &gt;&gt; fname;

    ifstream input;
    input.open(fname.c_str());
    input &gt;&gt; size;
    int numbers[size];

    for (int n = 0; n &lt; size; n++)
        input &gt;&gt; numbers[n];

    for (m = 0 ; m &lt; size ; m++)
    {
        if (numbers[m] &gt; highNum)
            highNum = numbers[m];
    }
    int j;
    int k;
    bool values[] = {false, false, false, false, false, false};

    for (j = highNum; j &gt; 0 ; j--)
    {
        for (k = size - 1 ; k &gt;= 0 ; k--)
        {
            if (j &lt;= numbers[k])
                values[k] = true;
        }

        if (values[0])
            cout &lt;&lt; "| xxx";
        else
            cout &lt;&lt; "|    ";
        if (values[1])
            cout &lt;&lt; "   +++";
        else
            cout &lt;&lt; "      ";
        if (values[2])
            cout &lt;&lt; "   ***";
        else
            cout &lt;&lt; "      ";
        if (values[3])
            cout &lt;&lt; "   ---";
        else
            cout &lt;&lt; "      ";
        if (values[4])
            cout &lt;&lt; "   +++";
        else
            cout &lt;&lt; "      ";
        if (values[5])
            cout &lt;&lt; "   +++" &lt;&lt; endl;
        else
            cout &lt;&lt; "      " &lt;&lt; endl;

    }

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

<p>I am trying to write a code to print a bar chart by reading integers from a separate text file.  I posted the complete code, but I know the bottom half works if you just input numbers.  I was wondering what the problem with this is given that there is a data file in the same directory.  When I run this program and enter the name of the data file i created to test it, the program runs, but no graph is produced.</p>
