title: colored text in windows command prompt in one line
body: <p>I want to change specific words color in windows command prompt, it work like this just fine:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;windows.h&gt;
  
  using namespace std;
  
  string setcolor(unsigned short color){
      HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hcon, color);
      return "";
  }
  
  int main(int argc, char** argv)
  {
      setcolor(13);
      cout &lt;&lt; "Hello ";
      setcolor(11);
      cout &lt;&lt; "World!" &lt;&lt; endl;
      setcolor(7);
      system("PAUSE");
      return 0;
  }
  </code></pre>
  
  <p>but I want my function work like this</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;windows.h&gt;
  
  using namespace std;
  
  string setcolor(unsigned short color){
      HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hcon, color);
      return "";
  }
  
  int main(int argc, char** argv)
  {
      cout &lt;&lt; setcolor(13) &lt;&lt; "Hello " &lt;&lt; setcolor(50) &lt;&lt; "World!" &lt;&lt; setcolor(7) &lt;&lt; endl;
      system("PAUSE");
      return 0;
  }
  </code></pre>
  
  <p>when I run it only setcolor(13) works and then color never changes till the end , what should I do to fix this problem</p>