title: Returning two values of two different types in a C++ function
body: <p>I'm writing a program that performs a simple rotation (think like rot13) on a string taken from user input. My problem is that I want to change each character in the string's ASCII value by a different amount each time - and so I'm using a for loop to go through the string, and calling a function that generates a random number each time. However, I want to be able to return this number so that I can "unscramble" the string at a later date. I also need to return the string though, obviously. </p>
  
  <p>Here's my code: </p>
  
  <pre><code>int ranFunction()
  {
  
      int number = rand() % 31;
      return number;
  
  }
  
  string rotFunction(string words)
  {
      int upper_A = 65;
      int lower_z = 122;
      int rand_int = 0;
  
      for (int i = 0; i &lt; words.length(); i++)
      {
          rand_int = ranFunction();
  
          if (words[i] &gt;= upper_A &amp;&amp; words[i] &lt;= lower_z) {
  
              words[i] -= rand_int;
  
  
          }
  
      }
      return words; 
  }
  </code></pre>
  
  <p>I'm hoping to get rotFunction to return words AND an integer based on whatever rand_int happens to be each time. </p>
  
  <p>Just a note: the numbers I'm using RE: ascii values etc are totally arbitrary right now, just there for testing.</p>