to_string知道的话会好写很多吧~
#include<bits/stdc++.h>
using namespace std;
char s[10][10]={"zero","one","two","three","four","five","six","seven","eight","nine"};
int main(){
string p;
cin>>p;
int res=0;
for(auto it:p){
res+=it-'0';
}
p=to_string(res);
for(auto it:p){
cout<<s[it-'0']<<" ";
}
}