title: I want to detect if a character has been entered by the user before enter is pressed
body: <p>I'm creating a text editor and here is its code: </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;conio.h&gt;
  
  int main()
  {
      system("cls"); system("COLOR F0");
      std::string input;
      static int lineNo=0;
      while(true)
      {
          lineNo+=1;
          std::cout &lt;&lt; lineNo &lt;&lt; "\t";
          input=="{" ? std::cout &lt;&lt; "\t" : std::cout &lt;&lt; "";
          input=="(" ? std::cout &lt;&lt; "\t" : std::cout &lt;&lt; "";
          input=="[" ? std::cout &lt;&lt; "\t" : std::cout &lt;&lt; "";
          std::getline(std::cin, input);
      }
      return 0;
  }
  </code></pre>
  
  <p>I want to create an auto-completion tool for the brackets which enters the closing bracket instantly after the opening brace has been typed. Please help me as I am just a beginner.</p>