-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6.cpp
More file actions
65 lines (58 loc) · 955 Bytes
/
6.cpp
File metadata and controls
65 lines (58 loc) · 955 Bytes
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include<iostream>
#include<string>
using namespace std;
string printnum(int num, int digit)
{
if(num == 0)
return "";
else if(num == 1)
{
if(digit == 1)
return "일";
else
return "";
}
else if(num == 2)
return "이";
else if(num == 3)
return "삼";
else if(num == 4)
return "사";
else if(num == 5)
return "오";
else if(num == 6)
return "육";
else if(num == 7)
return "칠";
else if(num == 8)
return "팔";
else if(num == 9)
return "구";
}
void printhan(int num)
{
if(num/1000 != 0)
cout << printnum(num/1000,1000) << "천 ";
num = num % 1000;
if(num/100 != 0)
cout << printnum(num/100,100) << "백 ";
num = num % 100;
if(num/10 != 0)
cout << printnum(num/10,10) << "십 ";
num = num % 10;
cout << printnum(num,1) << "";
}
int main()
{
int number;
cin >> number;
int man = number / 10000;
number = number % 10000;
if(man != 0)
{
printhan(man);
cout << "만 ";
}
printhan(number);
return 0;
}