文章图片
??
【PAT|1002. 写出这个数 (20)】
文章图片
#include
#include
#include
using namespace std;
int main()
{
int n=0;
char ch;
string st;
stack s;
bool flag = false;
while((ch=cin.get())!='\n')
{
n+=ch-'0';
}
while(n)
{
switch(n%10)
{
case 0:
st = "ling";
break;
case 1:
st = "yi";
break;
case 2:
st = "er";
break;
case 3:
st = "san";
break;
case 4:
st = "si";
break;
case 5:
st = "wu";
break;
case 6:
st = "liu";
break;
case 7:
st = "qi";
break;
case 8:
st = "ba";
break;
case 9:
st = "jiu";
break;
}
s.push(st);
n/=10;
} while(!s.empty())
{
if(flag)
cout<<" ";
else
flag = true;
cout<
??
推荐阅读
- PAT|Heaps
- PAT|(pat)A1030. Travel Plan
- PAT|DevC++使用技巧
- PAT|PAT甲级 1102 Invert a Binary Tree 反转树再层序中序输出
- PAT|1061 判断题 (15 分)
- PAT|1060 爱丁顿数 (25 分)
- PAT|1059 C语言竞赛 (20 分)
- PAT乙级 ——写出这个数