displaying user inputs using pointers c++
<p>Help me to know what is wrong with it because i'm just a beginner, I'm trying to build a program that ask the user to enter short sentences until the user quit and display them in reverse order:
example
user enter:</p>

<pre><code>My name is Todd
I like to travel
</code></pre>

<p>and display like that:</p>

<pre><code>I like to travel
My name is Todd
</code></pre>

<p>Anyone can help me to make it work right;
It works right but does not pause it exit right away after execution. I want to be able to hold on the window.
Thanks in advance</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;iterator&gt;
#include &lt;vector&gt;
using namespace std;

int main(int argc, char *argv[])
{
    const int SIZE = 500;
    char input[SIZE];

    // collection that will hold our lines of text
    vector&lt;string&gt; lines;
    do
    {   // prompt the user
        cout &lt;&lt; "Enter a short sentence(&lt;enter&gt; to exit): ";
        cin.getline(input,SIZE);
        if (!getline(cin, input) || input.empty())
            break;
        lines.push_back(input);
    } while (true);

    // send back to output using reverse iterators
    //  to switch line order.
    copy(lines.rbegin(), lines.rend(),
         ostream_iterator&lt;string&gt;(cout, "\n"));
      // assume the file to reverse-print is the first
    //  command-line parameter. if we don't have one
    //  we need to leave now.
    if (argc &lt; 2)
        return EXIT_FAILURE;

    // will hold our file data
    std::vector&lt;char&gt; data;

    // open file, turning off white-space skipping
    cin&gt;&gt;(argv[1]);
    cin.seekg(0, cin.end);
    size_t len = cin.tellg();
    cin.seekg(0, cin.beg);

    // resize buffer to hold (len+1) chars
    data.resize(len+1);
    cin.read(&amp;data[0], len);
    data[len] = 0; // terminator

    // walk the buffer backwards. at each newline, send
    //  everything *past* it to stdout, then overwrite the
    //  newline char with a nullchar (0), and continue on.
    char *start = &amp;data[0];
    char *p = start + (data.size()-1);
    for (;p != start; --p)
    {
        if (*p == '\n')
        {
            if (*(p+1))
                cout &lt;&lt; (p+1) &lt;&lt; endl;
            *p = 0;
        }
    }

    // last line (the first line)
    cout &lt;&lt; p &lt;&lt; endl;

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