Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.
Input Specification:
Each input file contains one test case. Each case occupies one line which contains an N (≤$10^{100}$).
Output Specification:
For each test case, output in one line the digits of the sum in English words. There must be one space between two consecutive words, but no extra space at the end of a line.
Sample Input:
1 | 12345 |
Sample Output:
1 | one five |
分析:
题目要求:给定一个非负数N,计算其各位数字之和,并输出和的每一位的英文表示。
思路:以字符串的形式读入n,计算其各位数字之和sum,将sum转换为字符串result,输出result每一位对应的英文表示。
1.纯c风格(不使用c++的string)
1 |
|
2.c++风格(使用string)
1 |
|