1: #include <iostream.h>
2: int q(float);
3: #include <math.h>
4: void main()
5: {
6: float number;
7: int w,x,y,z,L;
8: char* A;
9: char* B;
10: char* C;
11: char *a[10]={"","ONE HUNDERD","TWO HUNDERD","THREE HUNDERD",
"FOUR HUNDERD","FIVE HUNDERD","SIX HUNDERD","SEVEN HUNDERD",
"EIGHT HUNDERD","NINE HUNDERD"};
12: char *b[10]={"","","TWENTY","THERTY","FOURTY","FIFTY",
"SIXTY","SEVENTY","EIGHTY","NINETY"};
13: char *c[10]={"","ONE","TWO","THREE","FOUR","FIVE","SIX",
"SEVEN","EIGHT","NINE"};
14: char *d[10]={"TEN","ELEVEN","TWELVE","THIRTEEN",
15: "FOURTEEN","FIFTEEN","SEVENTEEN","EIGHTEEN","NINETEEN"};
16:
17: cout<<"Enter Number Between 0 and 999\n";
18: cin>>number;
19:
20: int G= q(number);
21:
22: x=(int)number/100;
23: w=(int)number%100;
24: y=w/10;
25: z=w%10;
26:
27: if(y==1)
28: {
29: for(int i=0;i<10;i++)
30: if(x==i)
31: A=a[i]; cout<<A<<" ";
32:
33: for(int r=0;r<10;r++)
34: if(y==1 && z==r)
35: B=d[r];
36: cout<<B<<" "<<"AND "<<G<<"/100";
37: }
38: else
39: {
40:
41: for(int h=0;h<10;h++)
42: if(x==h)
43: A=a[h]; cout<<A<<" ";
44:
45: for(int v=0;v<10;v++)
46: if(y==v)
47: B=b[v];
48: cout<<B<<" ";
49:
50: for(int n=0;n<10;n++)
51: if(z==n)
52: C=c[n];
53: cout<<C<<" "<<"AND "<<G<<"/100";
54: }
55: }
56:
57: int q(float number)
58: {
59: int a,b,c;
60: a=number*100;
61: b=a%1000;
62: c=b%100;
63: return c;
64: }
No comments:
Post a Comment