title: While Loop contines forever to get end of input string
body: <p>How do I run the while loop until the end of line or null character reached.</p>
  
  <p>Here is my code</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  main()
  {
      char input[20];
      cout&lt;&lt;"Enter a line: ";
      cin&gt;&gt;input;
  
      while(input!='\0')
      {
          cout&lt;&lt;"This is a text";
  
      }
      system("pause");
  }
  </code></pre>