string int_name(int n)
{
int c = n; /* the part that needs to be converted */
string r; /* the return value */
if (c >= 1000)
{
r = name of thousands in c + "thousand"
remove thousands from c
}
if (c >= 100)
{
r = r + name of hundreds in c + "hundreds"
remove hundreds from c
}
if (c >= 20)
{
r = r + name of tens in c
remove tens from c
}
if (c >= 10)
{
r = r + name of c
c = 0
}
if (c > 0)
r = r + name of c;
return r;
}