Read in a natural number n, calculate the sum of their numbers, and write each digit in Hanyu Pinyin.
input Format: each test input contains 1 test cases, which gives the value of the natural number N. This guarantees that n is less than 10100.
output format: output n in one line each digit of the sum of the number of digits, there are 1 spaces between the phonetic numerals, but there is no space after the last phonetic number in a row.
Input Sample:
1234567890987654321123456789
Sample output:
Yi San Wu
1#include <iostream>2#include <cstring>3 using namespacestd;4 voidOutputintsum)5 {6 if(sum<=9)7 {8 Switch(sum)9 {Ten Case 0:cout<<"Ling"; Break; One Case 1:cout<<"Yi"; Break; A Case 2:cout<<"er"; Break; - Case 3:cout<<"San"; Break; - Case 4:cout<<"si"; Break; the Case 5:cout<<"Wu"; Break; - Case 6:cout<<"Liu"; Break; - Case 7:cout<<"Qi"; Break; - Case 8:cout<<"BA"; Break; + Case 9:cout<<"JIU"; Break; - } + } A Else { atOutput (sum/Ten); -cout<<" "; -Output (sum%Ten); - } - } - in intMain () - { to Charc[101]; + intsum=0; - gets (c); the for(intI=0; c[i]!=' /'; i++) *sum+= (c[i]-'0'); $ //cout<<sum<<endl;Panax Notoginseng output (sum); - //System ("pause"); the return 0; +}View Code
Pat 1002. Write this number (20)