1005. Spell It Right (20)
2017-02-18 10:01
288 查看
https://www.patest.cn/contests/pat-a-practise/1005
#include <cstdio> #include <iostream> #include <cstring> #include <string> #include <cstdlib> using namespace std; string SpellRight(int i) { switch (i) { case 0:return "zero"; break; case 1:return "one"; break; case 2:return "two"; break; case 3:return "three"; break; case 4:return "four"; break; case 5:return "five"; break; case 6:return "six"; break; case 7:return "seven"; break; case 8:return "eight"; break; } return "nine"; } int main() { char N[101]; cin >> N; int temp = 0; int len = strlen(N); string ma; for (int i = 0; i < len; i++) { temp += (N[i] - '0'); } ma = SpellRight(temp%10); //five //12345 temp /= 10; // while (temp) { ma = " " + ma; ma = SpellRight(temp % 10) + ma; temp /= 10; } cout << ma << endl; system("pause"); return 0; }
相关文章推荐
- 1005. Spell It Right (20)
- PAT甲题题解-1005. Spell It Right (20)-数位求和,水
- 1005. Spell It Right (20) PAT甲级刷题
- 1005. Spell It Right (20)
- [PAT] 1005 Spell It Right (20)
- PAT:A1005. Spell It Right (20/20)
- pat 1005. Spell It Right (20)
- PAT甲级.1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- PAT 1005. Spell It Right (20)
- PAT1005. Spell It Right (20)
- 1005. Spell It Right (20)
- PAT (Advanced Level) Practise 1005. Spell It Right (20)
- 【PAT甲级】1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- PAT (Advanced Level) 1005. Spell It Right (20)