if(num/100>=1)
	{
		x=num/100;
		switch(x)
		{
			case 1: cout<<"one hundred "; break;
			case 2: cout<<"two hundred "; break;
			case 3: cout<<"three hundred "; break;
			case 4: cout<<"four hundred "; break;
			case 5: cout<<"five hundred "; break;
			case 6: cout<<"six hundred "; break;
			case 7: cout<<"seven hundred "; break;
			case 8: cout<<"eight hundred "; break;
			case 9: cout<<"nine hundred "; break;
		}
		num=num%100;
	}

	if(num/10>=1)
	{
		x=num/10;
		switch(x)
		{
			case 2: cout<<"twenty "; break;
			case 3: cout<<"thirty "; break;
			case 4: cout<<"fourty "; break;
			case 5: cout<<"fifty "; break;
			case 6: cout<<"sixty "; break;
			case 7: cout<<"seventy "; break;
			case 8: cout<<"eighty "; break;
			case 9: cout<<"ninety "; break;
		}
	if(num/1>9)
	{
		x=num/1;
		switch(x)
		{
			case 10: cout<<"ten "; break;
			case 11: cout<<"eleven "; break;
			case 12: cout<<"twelve "; break;
			case 13: cout<<"thirteen "; break;
			case 14: cout<<"fourteen "; break;
			case 15: cout<<"fifteen "; break;
			case 16: cout<<"sixteen "; break;
			case 17: cout<<"seventeen "; break;
			case 18: cout<<"eighteen "; break;
			case 19: cout<<"nineteen "; break;
		}
	}
		num=num%10;
	}

	if(num/1>=1)
	{
		x=num/1;
		switch(x)
		{
			case 1: cout<<"one "; break;
			case 2: cout<<"two "; break;
			case 3: cout<<"three "; break;
			case 4: cout<<"four " ; break;
			case 5: cout<<"five "; break;
			case 6: cout<<"six "; break;
			case 7: cout<<"seven "; break;
			case 8: cout<<"eight "; break;
			case 9: cout<<"nine "; break;
		}
	}

Here's my program and here are the outputs:

921 - nine hundred twenty one
912 - nine hundred twelve two
902 - nine hundred two

Now, I can't figure out how I can display 912 as nine hundred twelve and not nine hundred twelve TWO. That's what happens everytime I input numbers with 11 to 19 as the last two digits.

More examples:
911 - nine hundred eleven ONE
319 - three hundred nineteen NINE
717 - seven hundred seventeen SEVEN

Please help. Thank you! :)

You need to output the teens OR the ones value -- not both.

If output 00,20-90, output 0-9
but if output 10-19 don't output 0-9

This article has been dead for over six months. Start a new discussion instead.