题目描述:

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 (≤).

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:

12345

Sample Output:

one five

问题分析:此题过于弱智,没有思路,干就完了,奥里给!

代码:
 #include <iostream>
#include <cstring>
#include <string>
using namespace std; const string x[]={"zero","one","two","three","four","five","six","seven","eight","nine"}; int main(){
char ch[];
int a[],l,sum=;
cin.getline(ch,);
for (int i=;i<=;i++){
if (isdigit(ch[i])){
sum+=ch[i]-'';
}
else{
break;
}
}
for (int i=;;i++){
a[i]=sum % ;
sum/=;
if (sum==){
l=i+;
break;
}
}
for (int i=l-;i>;i--){
cout << x[a[i]] << " ";
}
cout << x[a[]];
return ;
}

最新文章

  1. 【转】Python练习,网络爬虫框架Scrapy
  2. 深入理解JS的delete
  3. Struts2上传大小限制
  4. win32下的双缓冲绘图技术
  5. angular+bootstrap+MVC 之二,模态窗
  6. CSS3实现旋转的太极图(二):只用1个DIV
  7. [转]面向GPU的多LOD因子的大规模场景可视化策略
  8. Java-日期转换
  9. C# 跨线程访问或者设置UI线程控件的方法
  10. 13.熟悉JDK的配置,环境变量
  11. linux打开文件数量的查看方法
  12. 会话标识未更新(AppScan扫描结果)
  13. AE 栅格处理
  14. 2015-10-15 晴 APUE GIT
  15. JMeter之Throughput Controller详解(实验)
  16. 开源项目——小Q聊天机器人V1.2
  17. 当 “HTTP” 先生遇上“S”小姐
  18. 《JAVA程序设计》_第九周学习总结
  19. Git合并不同url的项目
  20. 关于maven环境变量的配置问题

热门文章

  1. 每日一练PAT_B_PRAC_1002
  2. 题解【Luogu6022 快乐水】
  3. python机器学习——正则化
  4. python中的PYC文件是什么?
  5. webpack 中那些最易混淆的 5 个知识点
  6. C++ 常用编程--Swap函数有几种写法?
  7. python新手如何编写一个猜数字小游戏
  8. ASP.NET Core Web API中带有刷新令牌的JWT身份验证流程
  9. kms在线激活windows和office
  10. pikachu-跨站脚本漏洞(XSS)