#include<iostream>
using namespace std;
void hangdonvi(int a)
{
if (a == 1)
cout << "mot ";
if (a == 2)
cout << "hai ";
if (a == 3)
cout << "ba ";
if (a == 4)
cout << "bon ";
if (a == 5)
cout << "nam ";
if (a == 6)
cout << "sau ";
if (a == 7)
cout << "bay ";
if (a == 8)
cout << "tam ";
if (a == 9)
cout << "chin ";
}
void hangchuc(int a)
{
if (a == 0)
cout << "le ";
if (a == 1)
cout << "muoi ";
if (a == 2)
cout << "hai muoi ";
if (a == 3)
cout << "ba muoi ";
if (a == 4)
cout << "bon muoi ";
if (a == 5)
cout << "nam muoi ";
if (a == 6)
cout << "sau muoi ";
if (a == 7)
cout << "bay muoi";
if (a == 8)
cout << "tam muoi ";
if (a == 9)
cout << "chin muoi ";
}
void hangtram(int a)
{
if (a == 0)
cout << " khong tram ";
if (a == 1)
cout << "mot tram ";
if (a == 2)
cout << "hai tram ";
if (a == 3)
cout << "ba tram ";
if (a == 4)
cout << "bon tram ";
if (a == 5)
cout << "nam tram ";
if (a == 6)
cout << "sau tram ";
if (a == 7)
cout << "bay tram ";
if (a == 8)
cout << "tam tram ";
if (a == 9)
cout << "chin tram ";
}
void hangchucngan(int a)
{
if (a == 0)
cout << "le ";
if (a == 1)
cout << "muoi ";
if (a == 2)
cout << "hai muoi ";
if (a == 3)
cout << "ba muoi ";
if (a == 4)
cout << "bon muoi ";
if (a == 5)
cout << "nam muoi ";
if (a == 6)
cout << "sau muoi ";
if (a == 7)
cout << "bay muoi";
if (a == 8)
cout << "tam muoi ";
if (a == 9)
cout << "chin muoi ";
}
void hangtramngan(int a)
{
if (a == 1)
cout << "mot tram ";
if (a == 2)
cout << "hai tram ";
if (a == 3)
cout << "ba tram ";
if (a == 4)
cout << "bon tram ";
if (a == 5)
cout << "nam tram ";
if (a == 6)
cout << "sau tram ";
if (a == 7)
cout << "bay tram ";
if (a == 8)
cout << "tam tram ";
if (a == 9)
cout << "chin tram ";
}
void hangngan(int a)
{
if (a == 0)
cout << " ngan ";
if (a == 1)
cout << "mot ngan ";
if (a == 2)
cout << "hai ngan ";
if (a == 3)
cout << "ba ngan ";
if (a == 4)
cout << "bon ngan ";
if (a == 5)
cout << "nam ngan ";
if (a == 6)
cout << "sau ngan ";
if (a == 7)
cout << "bay ngan ";
if (a == 8)
cout << "tam ngan ";
if (a == 9)
cout << "chin ngan ";
}
int xuly(int n)
{
int hangtramngan1 = n / 100000;
int hangchucngan1 = (n / 10000) % 10;
int hangngan1 = (n / 1000) % 10;
int hangtram1 = (n / 100) % 10;
int hangchuc1 = (n / 10) % 10;
int donvi1 = n % 10;
hangtramngan(hangtramngan1);
hangchucngan(hangchucngan1);
if (hangtram1 == 0 && hangchuc1 == 0 && donvi1 == 0 && hangtramngan1 == 0 && hangchucngan1 == 0 && hangngan1 == 0)
{
return 0;
}
else
{
hangngan(hangngan1);
hangtram(hangtram1);
hangchuc(hangchuc1);
hangdonvi(donvi1);
}
}
int main()
{
int n;
do
{
cout << "nhap n : ";
cin >> n;
if (n < 0 || n >= 10000000)
{
cout << "so wa lon : xin nhap lai ! ";
}
} while (n < 0 || n >= 10000000);
xuly(n);
system("pause");
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.