15,902,032 members
See more:
Hello,

I need a c++ program that take an integer input value from 1 to 999 and display its word. For example if the user enter 358 then output should be "Three hundred and fifty eight".

Posted
Updated 4-May-10 6:11am
v2

## Solution 1

Google[^] not working where you are?

## Solution 3

Should look something like this:

```int main()
{
cout<<"Enter an integer between 1 and 999\n";
int a;
cin>>a;

if (a==1)
{
cout<<"One\n";
}
else if (a==2)
{
cout<<"Two\n";
}
else if (a==3)
{
cout<<"Three\n";
}
// else if... repeat till 999
}```

OriginalGriff 4-May-10 15:03pm
It has the advantages of working, being very tedious to enter, and failing his course! I like it :laugh:
William Winner 4-May-10 15:04pm
nice...shouldn't take too long to implement!
Emilio Garavaglia 7-May-10 7:47am
OK... it works.
Now let's chage it top work up to 1'000'000
:-)

## Solution 2

What do you think to learn if someone else does your homework for you?

CPallini 4-May-10 13:08pm
'How to obtain a career in Management', I suppose.
:-)
Sauro Viti 4-May-10 13:17pm
:-) Hey! You are right! There is someone who like to do my homeworks?

## Solution 4

C#
```int main()
{
cout<<"Enter an integer between 1 and 999\n";
int a;
cin>>a;
int result[3];
int i;
for(i=0;i<3&&a>0;i++)
{
result[i]=a%10;
a=a/10;
}
if(a<0)
i-=1;

for(int j=i; j>=0;j--)
{
switch(result[j])
{
case 0:
cout<<"zero";
break;
case 1:
cout<<"one";
break;
case 2:
cout<<"two";
break;
.... till "9"
}
}
}```

v3
CPallini 27-May-13 6:18am
What's the purpose of adding a wrong solution to a three years old question?
satz_770 28-May-13 1:08am
Updated it , now check, instead of a simple thing you are writing it from 0 to 999, that made me give this solution!!!