Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.facebook.com/pages/C%C3%B9ng-h%E1%BB%8Dc-l%E1%BA%ADp-tr%C3%ACnh/632038696941833?ref=bookmarks
- #include <iostream>
- using namespace std;
- char so[][7] = { " khong", " mot", " hai", " ba", " bon", " nam", " sau", " bay", " tam", " chin" };
- char dv[][9] = { " trieu", " nghin", " tram", " muoi", " le"};
- void main()
- {
- long int n = 0, a;
- int t = 0;
- cout << endl;
- cin >> a;
- while (a > 0)
- {
- n = n * 10 + (a % 10);
- a = a / 10;
- t++;
- }
- while (n > 0)
- {
- if (n % 10 != 0 || t % 3 == 0)
- {
- if (t % 3 == 2 && n % 10 == 1);
- else
- cout << so[n % 10];
- }
- if ((t - 1) / 3.0 == 1) cout << dv[1];
- if ((t - 1) / 3.0 == 2) cout << dv[0];
- if (t % 3 == 0) cout << dv[2];
- if (t % 3 == 2)
- {
- if (n % 10 == 0) cout << dv[4];
- else
- cout << dv[3];
- }
- n = n / 10;
- t--;
- }
- if (t > 3 && t < 6) cout << dv[1];
- if (t > 6) cout << dv[0];
- main();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement