注意用do....while()
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
string s;
string number[10] = { "zero","one","two","three","four","five","six","seven","eight","nine" };
int main()
{
cin >> s;
int ans = 0;
for (int i = 0; i < s.length(); i++)ans += s[i] - '0';
int num[100];
int cnt = 0;
do {
num[cnt++] = ans % 10;
ans /= 10;
} while (ans);
reverse(num, num + cnt);
for (int i = 0; i < cnt; i++)
{
cout << number[num[i]];
if (i != cnt - 1)cout << " ";
}
return 0;
}