how to exit after no input in a c++ program+
<p>Hi guys i am new to c++, I just wrote this code to find min/max of a array of numbers.<br>
I just want to know how can I make the no. of entries flexible(I mean the user should be able to enter as many entries as possible without specifying how many in the starting)
<br>
Here's the code, but its not working, can someone please help?
Thanks
code:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;
int main(){

    cout&lt;&lt;"Program to calculate max/min/second max\n";
    int *A;
    A=new int[5];
    bool flag=false;
    int x=0,i=0;
    cout&lt;&lt;"Enter the numbers\n";

    do{

        cin&gt;&gt;x;
        if(x=='\0'){
            flag=true;
        }
        *(A+i)=x;
        i++;

    }
    while(!flag);

    for(int j=0;j&lt;i;j++){


        cout&lt;&lt;*(A+j)&lt;&lt;"\n";

    }

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