title: Can you add variables inside "cout"
body: <p>I'm new to C++, on the chapter 2 quiz of LearnCpp.com.  I'm stuck and have a question.  Can you add variables inside a std::cout statement?  For example:</p>
  
  <p>The program will not display my answer.  The program ends as soon as the user presses enter after inputting the values.  Thanks for your help ahead of time.</p>
  
  <p>EDIT: Sorry for not posting the entire code.  I'm also new to forums.  I added the <code>()</code> like someone suggested.  When I ran the program I think I saw it display the answer for a split second and it doesn't show that <code>Press any key to continue. . .</code> </p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  
  int main()
  {
  double first_value;
  double second_value;
  char user_operator;
  
  std::cout &lt;&lt; "Enter a double value: ";
  std::cin &gt;&gt; first_value;
  std::cout &lt;&lt; "Enter a second double value: ";
  std::cin &gt;&gt; second_value;
  std::cout &lt;&lt; "Enter one of the following (+, -, *, /): ";
  std::cin &gt;&gt; user_operator;
  
  if (user_operator == 43 || user_operator == 45\
      || user_operator == 42 || user_operator == 47)
      switch (user_operator)
      {
          case 43:
              std::cout &lt;&lt; "  " &lt;&lt; (first_value + second_value) &lt;&lt; "\n";
              break;
          case 45:
              std::cout &lt;&lt; "  " &lt;&lt; (first_value - second_value) &lt;&lt; "\n";
              break;
          case 42:
              std::cout &lt;&lt; "  " &lt;&lt; (first_value * second_value) &lt;&lt; "\n";
              break;
          case 47:
              std::cout &lt;&lt; "  " &lt;&lt; (first_value / second_value) &lt;&lt; "\n";
              break;
      }
  else std::cout &lt;&lt; "Please enter a valid operator.";
  
  return 0;
  </code></pre>
  
  <p>}</p>