--- In [email protected], "jsdecastro28" <[EMAIL PROTECTED]> wrote:
>
> elow,I'm new to this groups and also new in C++
> i need help about writing a program that will ask the user for an 
> integer number and output the equivalent of t the input (1000-3000) 
> limit inclusive
> 
> ex:
> 
> input:1954
> output: one thousand nine hundred fifty-four
> 
> this is my code
> 
> #include<iostream.h>
> 
> void main()
> {
>    int num;
>    cin>>num;
>    
>    if(num < 1000 || num > 3000)
>    {
>       cout<<"invald";
>    }
>    else
>     {
>       temp = num/1000
>       num = num%1000;
>       switch(temp)
>       {
>         case 1 : cout<<"one thousand";
>         ....
>  ........................
> please help me i dont know if the code is right please anyone who 
> can give me the right code for thisproblem
> 
> thanks a lot,I'm really confuse T_T
>


dude this will need one hell lot of case statements

otherwise it is not quite possible to do it.

take out the last 2 digits of your number and use it in a case
and print one to ninty nine

take out the third digit and use it in case
as one hundred to nine hundred

take out the fourth digit and use it in case
as one thousand to nine thousand

this logic will work from 1 to 9999



Reply via email to