PAT|1002. 写出这个数 (20)

PAT|1002. 写出这个数 (20)
文章图片
??

【PAT|1002. 写出这个数 (20)】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<




??

    推荐阅读