# UVA 10101 Bangla Numbers ## 題目連結 [UVA 10101](https://vjudge.net/problem/UVA-10101) ### 題目內容 Bangla numbers normally use ’kuti’ (10000000), ’lakh’ (100000), ’hajar’ (1000), ’shata’ (100) while expanding and converting to text. You are going to write a program to convert a given number to text with them. ### 輸入限制 The input file may contain several test cases. Each case will contain a non-negative number ≤ 999999999999999. ### 輸出限制 For each case of input, you have to output a line starting with the case number with four digits adjustment followed by the converted text. ### 解題思路 setw(4)為將寬度設為4,num函式為看數字大小做遞迴。 ### 程式碼(1) ```cpp= #include<bits/stdc++.h> using namespace std; void num(long long n){ if(n>=10000000){ num(n/10000000); cout<<" kuti"; n%=10000000; } if(n>=100000){ num(n/100000); cout<<" lakh"; n%=100000; } if(n>=1000){ num(n/1000); cout<<" hajar"; n%=1000; } if(n>=100){ num(n/100); cout<<" shata"; n%=100; } if(n){ cout<<" "<<n; } } int main(){ long long a,kase=1; while(cin>>a){ cout<<setw(4)<<kase++<<"."; if(a){ num(a); } else{ cout<<" 0"; } cout<<endl; } } ``` ## 測資 ### Sample input 23764 45897458973958 ### Sample output 1. 23 hajar 7 shata 64 2. 45 lakh 89 hajar 7 shata 45 kuti 89 lakh 73 hajar 9 shata 58 ## 中文題目連結 [zerojudge a741](https://zerojudge.tw/ShowProblem?problemid=a741)