Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- string read(int value)
- {
- switch(value)
- {
- case 0:
- return "";
- break;
- case 1:
- return "mot";
- break;
- case 2:
- return "hai";
- break;
- case 3:
- return "ba";
- break;
- case 4:
- return "bon";
- break;
- case 5:
- return "nam";
- break;
- case 6:
- return "sau";
- break;
- case 7:
- return "bay";
- break;
- case 8:
- return "tam";
- break;
- case 9:
- return "chin";
- break;
- }
- }
- void toText(int x)
- {
- int temp = x;
- int x1 = temp % 10;
- temp = temp / 10;
- int x2 = temp % 10;
- temp = temp / 10;
- int x3 = temp % 10;
- temp = temp / 10;
- int x4 = temp % 10;
- temp = temp / 10;
- int x5 = temp % 10;
- temp = temp / 10;
- int x6 = temp % 10;
- temp = temp / 10;
- int x7 = temp % 10;
- temp = temp / 10;
- int x8 = temp % 10;
- temp = temp / 10;
- int x9 = temp % 10;
- temp = temp / 10;
- int x10 = temp % 10;
- string t1 = read(x1);
- string t2 = read(x2);
- string t3 = read(x3);
- string t4 = read(x4);
- string t5 = read(x5);
- string t6 = read(x6);
- string t7 = read(x7);
- string t8 = read(x8);
- string t9 = read(x9);
- string t10 = read(x10);
- if (x1 == 0 && x2 == 0 && x3 == 0 && x4 == 0 && x5 == 0 && x6 == 0 && x7 == 0 && x8 == 0 && x9 == 0 && x10 == 0) cout << "Khong";
- //ty
- if (x10 != 0)
- {
- cout << t10;
- cout << " ty ";
- }
- //Trieu
- if (x9 == 0 && x10 == 0) cout << "";
- else if (x9 == 0 && (x8 != 0 || x7 != 0)) cout << "khong tram ";
- else if (x9 != 0)
- {
- cout << t9 << " ";
- cout << "tram ";
- }
- if (x8 == 1) cout << "muoi ";
- else if(x8 != 0)
- {
- cout << t8 << " ";
- cout << "muoi ";
- }
- if (x8 == 0 && x7 != 0 && x > 100000000) cout << "linh ";
- if (x7 != 0) cout << t7 << " ";
- if (x7 != 0 || x8 != 0 || x9 != 0) cout << "trieu ";
- //Nghin
- if (x10 == 0 && x9 == 0 && x8 == 0 && x7 == 0 && x6 == 0) cout << "";
- else if (x6 == 0 && (x5 != 0 || x4 != 0)) cout << "khong tram ";
- else if (x6 != 0)
- {
- cout << t6 << " ";
- cout << "tram ";
- }
- if (x5 == 1) cout << "muoi ";
- else if (x5 != 0)
- {
- cout << t5 << " ";
- cout << "muoi ";
- }
- if (x5 == 0 && x4 != 0 && x > 100000) cout << "linh ";
- if (x4 != 0) cout << t4 << " ";
- if (x6 != 0 || x5 != 0 || x4 != 0) cout << "nghin ";
- //Tram
- if (x10 == 0 && x9 == 0 && x8 == 0 && x7 == 0 && x6 == 0 && x5 == 0 && x4 == 0 && x3 == 0) cout << "";
- else if (x3 == 0 && (x2 != 0 || x1 != 0)) cout << "khong tram ";
- else if (x3 != 0)
- {
- cout << t3 << " ";
- cout << "tram ";
- }
- //Chuc
- if (x2 == 1) cout << "muoi ";
- else if(x2 != 0)
- {
- cout << t2 << " ";
- cout << "muoi ";
- }
- //Don vi
- if (x > 100 && x2 == 0) cout << "linh ";
- cout << t1 << " ";
- }
- int main()
- {
- toText(1000000001);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement