How to convert numbers into words

How to convert numbers into words using ragged dynamic arrays? please help it's urgent

this is my solution:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
int main() 
{ 
char *Units[]={"ZERO", "ONE", "TWO", "THREE","FOUR","FIVE", "SIX","SEVEN", "EIGHT", "NINE"}; 
char *teens []={"TEN", "ELEVEN", "TWELVE","THIRTEEN", "FOURTEEN", "FIFTEEN", "SIXTEEN", "SEVENTEEN", "EIGHTEEN","NINETEEN" }; 
char *hundreds []= {"HUNDRED"}; 
char *tens []={ "ZERO", "TEN", "TWENTY", "THIRTY", "FOURTY", "FIFTY", "SIXTY", "SEVENTY", "EIGHTY", "NINETY"}; 
char *currency []={"Dollars"}; 

int num; 
cout<<"Enter the check amount "; 
cin>>num; 
cout<<"The check amount in words "<<endl; 

while(num > 0) 
{ 
int d=0; 
if(num >= 100) 
{ 

d = num / 100; 
cout<<Units[d]<<' '; 
cout<<*hundreds<<' ';; 
num = num % 100; 
} 
else if(num >= 20) 
{ 
d = num / 10; 
cout<<tens[d]<<' '; 
num = num % 10; 
} 
else if(num >= 10 && num < 20) 
{ 
d = num % 10; 
cout<<teens[d]<<' '; 
num = num / 100; 
} 
else 
{ 
cout<<Units[num]<<' '; 
num = num / 10; 
} 

}
Those are static arrays.

You want to make them all if not else if.
How is this different from your other post?
http://www.cplusplus.com/forum/general/130680/
Topic archived. No new replies allowed.