title: Compiler error while trying to print a string variable in C
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;random&gt;
  #include &lt;cstdlib&gt;
  #include &lt;time.h&gt;
  
  using namespace std;
  
  int getComputerChoice();
  int getPlayerChoice();
  string convertToString(int);
  
  int main()
  {
      int computerChoice, playerChoice;
      string choiceOne, choiceTwo;
  
      cout &lt;&lt; "ROCK PAPER SCISSORS MENU\n"
           &lt;&lt; "-------------------------\n"
           &lt;&lt; "p) Play Game\n"
           &lt;&lt; "q) Quit" &lt;&lt; endl;
  
      srand (time(NULL));
  
      computerChoice = getComputerChoice();
      playerChoice = getPlayerChoice();
  
      cout &lt;&lt; "You chose: " &lt;&lt; convertToString(playerChoice) &lt;&lt; endl;
      cout &lt;&lt; "The computer chose: " &lt;&lt; convertToString(computerChoice) &lt;&lt; endl;
  
      system("PAUSE");
      return 0;
  }
  
  int getComputerChoice()
  {
      int choiceComp = (rand() % 3) + 1;
      return choiceComp;
  }
  
  int getPlayerChoice()
  {
      int choicePlayer;
  
      do {
      cout &lt;&lt; "Rock, Paper or Scissors?\n"
           &lt;&lt; "1) Rock\n"
           &lt;&lt; "2) Paper\n"
           &lt;&lt; "3) Scissors\n"
           &lt;&lt; "Please enter your choice: " &lt;&lt; endl;
      cin &gt;&gt; choicePlayer;
      } while (choicePlayer &lt; 1 || choicePlayer &gt; 3);
  
      return choicePlayer;
  }
  
  string convertToString(int choiceAsInt)
  {
      string choiceName;
  
      if (choiceAsInt == 1)
      {
          choiceName = "Rock";
      }
      else if (choiceAsInt == 2)
      {
          choiceName = "Paper";
      }
      else choiceName = "Scissors";
  
      return choiceName;
  }
  </code></pre>
  
  <p>This is my code thus far. What I am trying to do is use a function to convert the user's input (which is an int) into a string for printing. Can anyone explain why my current code is causing a compiler error? Here is what the error is telling me: <code>Error   2   error C2679: binary '&lt;&lt;' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)</code> And for clarification, this is how the instructor wants us to create the program. We aren't allowed to simply accept the user's input as a string (later on in the program we have to do comparisons of the values and we don't know how to compare strings yet). Thanks in advance.</p>