hi narue!

i want a program that converts any number inputted into words. like "124" into "one hundred twenty-four"
i did figure out the logic but i don't know what specific codes to type.
i have my intro codes but i don't know how to do the rest.
here it is:

#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int main (void)
	int x;
	char y;

	cout <<"Enter a number to be converted into words: ""\n";
	cin >> x;
	y = x;

	if (x %= 20)

		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;	
		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;
	cout <<"\n";
	return 0;

// please teach me how... i'm still newbie in programming. xD thanks and more power...

Check post below this one!

Just a few things to take note of:

1. This thread is almost five years old.

2. On the previous point and your request for help - a full working example was given by Narue (again 5 years ago). As Narue stated - there are tons of examples for these number to words and vice versa conversions available on the web!

3. This is a C forum.

4. In the future - use code tags.


can u cr8 me program that words converted to numbers.(1-50) using switch. pls help me.

Please don't spam the forum asking people to solve a problem for you.
This article has been dead for over six months. Start a new discussion instead.