title: Clearing input stream
body: <p>I know this is too famous question but I cannot seem to find an answer </p>
  
  <p>I have smth like this: </p>
  
  <pre><code> while (true) {
  
          std::cout &lt;&lt; "\nCommand&gt; ";
          std::cin.get(input, MAX, '\n');
  
          std::string cmdtemp = input;
  
          std::string token;
          std::istringstream issc(cmdtemp);
  
          std::string cmd[MAX];
          while ( getline(issc, token, ' ') )
          {
              cmd[b] = token;
              b++;
          }
  
  
          if (cmd[0] == "help") {
              Help cmd(cmd);
              std::cin.ignore(100, '\n') ;
  
          }
          else if (cmd[0] == "modify")
              Command* cmd = new Modify;
  std::cin.ignore(100, '\n') ;
          else if (cmd[0] == "convert")
              Command* cmd = new Convert;
  std::cin.ignore(100, '\n') ;
          else if (cmd[0] == "show")
              Command* cmd = new Show;
  std::cin.ignore(100, '\n') ;
          else if (cmd[0] == "getrates") 
              Command* cmd = new Getrates;
  std::cin.ignore(100, '\n') ;
          else {
              std::cout &lt;&lt; "Wrong command. Type help for Help.";
  std::cin.ignore(100, '\n') ;        
  }
  </code></pre>
  
  <p>After second input, this becomes infinite loop(though the stream should be cleared even after 2nd input, am I right?), also, if I, for example, enter "help" two times, first one works but the second one doesn't</p>
  
  <p>What can I do to get user input correctly as many times as I wish?</p>
  
  <p>EDIT: When user enters one of the commands(if else...), an object is created and constructor runs. In case of "help" the constructor displays command list with explanations. This works only once in my case. When I enter "help", the constructor works but when I enter "help" once more, it displays infinitely many "wrong command" (else condition in my if else). That is because of stream I guess but I though cin.ignore(...) should clear and the code should work.
  Hope this explanation is enough :)</p>
  
  <p>Thanks in advance:)</p>