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)
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;
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...