What's wrong with this code?(converting numbers to words c++)
<p>Whenever I enter a number it hows something else. EX; when I enter 110 it shows one hundred. Or when I enter 560 it shows five hundred seventy. I am so tired of this. I've been working for so long and I still can't fix the problem. Pls help.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;conio.h&gt;
using namespace std;
int main() {
    int num, ones, tens, hundreds;
    cout &lt;&lt; "Enter a number from 1-1000: ";
    cin &gt;&gt; num;
    hundreds = ((num / 100) % 100) % 10;
    tens = (num / 10) % 10;
    ones = num % 10;
    switch (hundreds) {
    case 1:
        cout &lt;&lt; "One Hundred ";
        break;
    case 2:
        cout &lt;&lt; "Two Hundred ";
        break;
    case 3:
        cout &lt;&lt; "Three Hundred ";
        break;
    case 4:
        cout &lt;&lt; "Four Hundred ";
        break;
    case 5:
        cout &lt;&lt; "Five Hundred ";
        break;
    case 6:
        cout &lt;&lt; "Six Hundred ";
        break;
    case 7:
        cout &lt;&lt; "Seven Hundred ";
        break;
    case 8:
        cout &lt;&lt; "Eight Hundred ";
        break;
    case 9:
        cout &lt;&lt; "Nine Hundred ";
        break;
    }
    if (tens == 1) {
        switch (ones) {
        case 1:
            cout &lt;&lt; "Ten ";
            break;
        case 2:
            cout &lt;&lt; "Eleven ";
            break;
        case 3:
            cout &lt;&lt; "Twelve ";
            break;
        case 4:
            cout &lt;&lt; "Thirteen ";
            break;
        case 5:
            cout &lt;&lt; "Fourteen ";
            break;
        case 6:
            cout &lt;&lt; "Fifteen ";
            break;
        case 7:
            cout &lt;&lt; "Sixteen ";
            break;
        case 8:
            cout &lt;&lt; "Seventeen ";
            break;
        case 9:
            cout &lt;&lt; "Eighteen ";
            break;
        case 10:
            cout &lt;&lt; "Nineteen ";
            break;
        }
    } else if (tens) {
        switch (tens) {
        case 1:
            cout &lt;&lt; "Twenty ";
            break;
        case 2:
            cout &lt;&lt; "Thirty ";
            break;
        case 3:
            cout &lt;&lt; "Fourty ";
            break;
        case 4:
            cout &lt;&lt; "Fifty ";
            break;
        case 5:
            cout &lt;&lt; "Sixty ";
            break;
        case 6:
            cout &lt;&lt; "Seventy ";
            break;
        case 7:
            cout &lt;&lt; "Eighty ";
            break;
        case 8:
            cout &lt;&lt; "Ninety ";
            break;
        }
    } else if ((tens &gt; 1) &amp;&amp; (ones &gt; 0)) {
        switch (ones) {
        case 1:
            cout &lt;&lt; "One ";
            break;
        case 2:
            cout &lt;&lt; "Two ";
            break;
        case 3:
            cout &lt;&lt; "Three ";
            break;
        case 4:
            cout &lt;&lt; "Four ";
            break;
        case 5:
            cout &lt;&lt; "Five ";
            break;
        case 6:
            cout &lt;&lt; "Six ";
            break;
        case 7:
            cout &lt;&lt; "Seven ";
            break;
        case 8:
            cout &lt;&lt; "Eight ";
            break;
        case 9:
            cout &lt;&lt; "Nine ";
            break;
        }
    }
    getch();
}
</code></pre>
