拼写正确
我的代码:
#include <bits/stdc++.h>
using namespace std;
int main() {
long int ans = 0, a[1000];
string s, arr[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
cin >> s;
if (s == "0") {
cout << "zero" << endl;
} else {
for (int i = 0; i < s.length(); i++) {
ans += (s[i] - '0');
}
}
int q = 0;
while (ans != 0) {
a[q] = ans % 10;
ans /= 10;
q++;
}
for (int i = q - 1; i >= 0 ; i--) {
cout << arr[a[i]] << ' ';
}
return 0;
}