Adding a number to a word to call up a variable
<p>Please be nice I am a total newby.</p>

<p>I have a list of variables (strings) from num1 to num90. I need to call these from a function by adding the number in an int to the word num.</p>

<p>The task is to convert digits to words from 'jumping into c++'...I might not be going about it in the 'right' way but this part has been stopping me for a while now!!</p>

<p>I'm trying like this:</p>

<pre><code>    #include &lt;iostream&gt;
    #include &lt;string&gt;

    using namespace std;

    // Hard code numbers to 20 and then in tens to 90
    string num1 = "one";
    string num2 = "two";
    string num3 = "three";
    string num4 = "four";
    string num5 = "five";
    string num6 = "six";
    string num7 = "seven";
    string num8 = "eight";
    string num9 = "nine";
</code></pre>

<p>Etc...up to 90</p>

<pre><code>    int main ()
    {

    // Break the number down into three digit blocks
    int num = 0;

    cout &lt;&lt; "Please enter the number: ";
    cin &gt;&gt; num;


  while (num &gt; 999)
    {
int digit = (num % 1000);
num = ((num - digit)/1000);
//cout &lt;&lt; digit &lt;&lt; '\n';
//cout &lt;&lt; num &lt;&lt; '\n';

// For each block of numbers work out hundreds,


if (digit &gt; 100)
{
    int i = digit;
    int j = (i % 100);
    cout &lt;&lt; num.append(j) &lt;&lt; " hundred";
}
</code></pre>

<p>What I need to happen is the number stored in 'j' to be tagged onto the word num in order to call the string num*.</p>

<p>Is this possible?</p>
