title: Is there a way to hide variables in cout (C++)?
body: <p>I'm having an issue figuring out how to hide a specific variable (if that is even possible) in a cout function. Basically I need to do a number guess game, which would be easy enough except our teacher wants us to do it like a random math equation. Which... would honestly still be fairly easy except the way we have to do it is the program has to randomly create the problem and then randomly pick one of the 3 numbers to display and the user has to guess the other two missing numbers. For example if the program picked 20 + 32 = 52 it could potentially display __ + 32 = __.</p>
  
  <p>I've gotten that far however I can't figure out how to make it so it displays like that but still allows me to put the line something like this</p>
  
  <pre><code>    cout &lt;&lt; num1 //Hidden &lt;&lt; " + " &lt;&lt; num2 &lt;&lt; " = " &lt;&lt; num3 //Hidden
  </code></pre>
  
  <p>However like I said I don't even know if that is possible if not then I will probably have to rewrite the whole program. This is what I have so far:</p>
  
  <pre><code>int main()
  {
      int num1, num2, num3, random1, guess1, guess2;
      string play = "";
  
      cout &lt;&lt; "Would you like to run the number guessing program? (enter yes or no): ";
      getline(cin, play);
      for (int i = 0; i &lt; play.length(); i++)
      {
          play[i] = tolower(play[i]);
      }
  
      //Random seed
      srand(time(0));
  
      while (play == "yes")
      {
          //Generate random numbers and num3
          num1 = 1 + rand() % 50 + 1;
          num2 = 1 + rand() % 50 + 1;
          num3 = num1 + num2;
          int pickRandom[3] = { num1, num2, num3 };
  
          //Display random elements
          random1 = pickRandom[rand() % 3];
  
          if (random1 == num1){
              cout &lt;&lt; "\nYour randomly generated number problem: " &lt;&lt; num1 &lt;&lt; " + " &lt;&lt; "__" &lt;&lt; " = " &lt;&lt; "__" &lt;&lt; endl;
          }
          if (random1 == num2){
              cout &lt;&lt; "\nYour randomly generated number problem: " &lt;&lt; "__" &lt;&lt; " + " &lt;&lt; num2 &lt;&lt; " = " &lt;&lt; "__" &lt;&lt; endl;
          }
          if (random1 == num3){
              cout &lt;&lt; "\nYour randomly generated number problem: " &lt;&lt; "__" &lt;&lt; " + " &lt;&lt; "__" &lt;&lt; " = " &lt;&lt; num3 &lt;&lt; endl;
          }
          //Get Guesses
          cout &lt;&lt; "\nBased off of this information please make an educated guess as to what the two missing numbers are.";
          cout &lt;&lt; "\n\nGuess for number 1 (between 1 and 100): ";
          cin &gt;&gt; guess1;
          while ((guess1 &gt; 100) || (guess1 &lt; 0))
          {
              cout &lt;&lt; "\nSorry you need to enter an integer between 1 and 100" &lt;&lt; endl;
              cout &lt;&lt; "\nGuess for number 1 (between 1 and 100): ";
              cin &gt;&gt; guess1;
          }
          cout &lt;&lt; "\n\nGuess for number 2 (between 1 and 100): ";
          cin &gt;&gt; guess2;
          while ((guess2 &gt; 100) || (guess2 &lt; 0))
          {
              cout &lt;&lt; "\nSorry you need to enter an integer between 1 and 100" &lt;&lt; endl;
              cout &lt;&lt; "\nGuess for number 2 (between 1 and 100: ";
              cin &gt;&gt; guess2;
          }
          if (guess1 == )
      }
  
      return 0;
  }
  </code></pre>