I have this loop, where arr is an integer array.
for(int i=0; i<=counter;i++) { cin>>arr[i]; } I'm giving input like this
2 4 6 7 I want when enter is pressed after 7, just break this loop.
I think it can be done with something like
if(cin.get()=="\n") But I can't understand how to implement it here in this code.
arrhas at leastcounter+1elements and will have undefined behaviour ifarrhas onlycounterelements?