title: Reading a sentence until ENTER key pressed using 2-D char array
body: <p>I need to read a sentence word by word until "ENTER" key is pressed. I used a do..while loop to read words until ENTER key is pressed. Please suggest me some conditions for checking ENTER key press (or) others ways for reading similar input.  </p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string.h&gt;
  using namespace std;
  
  int main(){
  
       char a[100][20]={'\0'};
       int i=0;
  
       do{
          cin&gt;&gt;a[i++];
       } while( \\ Enter key is not pressed );
  
       for(int j= 0 ; j &lt; i ; j++)
          cout&lt;&lt; a[j] &lt;&lt; " "; 
      return 0;
   }
  </code></pre>