乙_1002 写出这个数
#include <sstream>
#include <iostream>
#include <stack>
using namespace std;
int main(){
string s;
stringstream ss;
#include <iostream>
#include <stack>
using namespace std;
int main(){
string s;
stringstream ss;
bool bl =true;
int sum =0 ,to;
cin >> s;
for(int i=0; i<s.length();i++){
sum += (s[i]-'0'); // 转化int
}
ss<< sum ;
ss>> s;
stack<int> st; //逆序输入
while(sum!=0){
st.push(sum %10);
sum = sum/10;
}
while(!st.empty()){
if(bl) bl=false; // 加空格
else cout << " ";
to = st.top();
st.pop();
switch(to){ // 判断数字
case 0 : cout << "ling";break;
case 1 : cout << "yi";break;
case 2: cout << "er"; break;
case 3: cout << "san"; break;
case 4: cout << "si"; break;
case 5: cout << "wu"; break;
case 6: cout << "liu"; break;
case 7: cout << "qi"; break;
case 8 : cout << "ba"; break;
case 9 : cout << "jiu"; break;
case 10: cout << "shi"; break;
}
}
ss>> s;
stack<int> st; //逆序输入
while(sum!=0){
st.push(sum %10);
sum = sum/10;
}
while(!st.empty()){
if(bl) bl=false; // 加空格
else cout << " ";
to = st.top();
st.pop();
switch(to){ // 判断数字
case 0 : cout << "ling";break;
case 1 : cout << "yi";break;
case 2: cout << "er"; break;
case 3: cout << "san"; break;
case 4: cout << "si"; break;
case 5: cout << "wu"; break;
case 6: cout << "liu"; break;
case 7: cout << "qi"; break;
case 8 : cout << "ba"; break;
case 9 : cout << "jiu"; break;
case 10: cout << "shi"; break;
}
}
return 0;
}
}