1002 写出这个数 (20 分)
#include <iostream> #include <string> #include <stack> using namespace std; int main(){ int sum = 0; string num; stack<int>number; string str[10] = {"ling", "yi", "er", "san", "si", "wu", "liu", "qi", "ba", "jiu"}; cin >> num; for (int i = 0; i < num.size(); i++){ sum += num[i] - '0'; } while (sum != 0){ number.push(sum % 10); sum /= 10; } while (!number.empty()){ cout << str[number.top()]; number.pop(); if (!number.empty()){ cout << ' '; } else{ cout << endl; } } return 0; }