Error with converting numbers to text
<p>Im writing a c++ program that convert numbers to text.</p>

<p>I got two problems(edit: just one now):</p>

<ul>
<li><p>The first problem is that the program only write out the numbers as 1-19 correct, everything from 20-99 such as when i wrote 34 for an example, the answear i get is thirty and not thirtyfour as it should be. After thirty it just comes errors and the program shut down. [Problem fixed]</p></li>
<li><p>The second problem is that i wish i could write numbers between 0-999 and not only 99 but im not sure how to do that</p>

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


int main()
  {
 int num, Ldight, Rdight;

    string ones[] = {"zero", "one", "two", "three", "four", 
            "five","six", "seven", "eight", "nine", "ten",
            "eleven", "twelve", "thirteen", "fourteen",  "fifteen",
            "sixteen", "seventeen", "eighteen", "nineteen"};

string tens[] = {"twenty","thirty","fourty","fifty", "sixty","seventy","eighty", "ninety"};


    cout &lt;&lt; "Pick a number between 1-99: ";
    cin &gt;&gt; num;

      if(num &lt;= 0)
          {
        cout &lt;&lt; "ERROR!" &lt;&lt; endl;
          }

   else if (num &gt;= 0 &amp;&amp; num &lt;= 19)
          {
cout &lt;&lt; "Your number is: " &lt;&lt; ones[Rdight] ;
          }

   else if (num &gt;=20 &amp;&amp; num &lt;=99)
    {
Rdight = num % 10;
Ldight = num / 10;

cout &lt;&lt; "Your number is: " &lt;&lt; tens[Ldight - 2] &lt;&lt; ones[Rdight];
     }

return 0;
}
</code></pre></li>
</ul>
