PAT Group Programming Ladder-practice set l1-007. Read the numbers.

Source: Internet
Author: User

Enter an integer that prints the phonetic alphabet for each number. When the integer is negative, the word "fu" is first output. 10 numbers correspond to the following pinyin:

0:ling1:yi2:er3:san4:si5:wu6:liu7:qi8:ba9:jiu

Input format:

The input gives an integer in a row, such as: 1234 .

Tip: integers include negative numbers, 0, and positive numbers.

Output format:

In a row output this integer corresponding to the pinyin, each number of pinyin separated by a space, there is no last space at the end of the line. such as yi er san si .

Input Sample:
-600
Sample output:
Fu Liu Ling Ling

1#include <iostream>2#include <stdio.h>3#include <cstring>4 using namespacestd;5 voidPrintCharch)6 {7     if(ch=='-') printf ("Fu");8     Else if(ch=='0') printf ("Ling");9     Else if(ch=='1') printf ("Yi");Ten     Else if(ch=='2') printf ("er"); One     Else if(ch=='3') printf ("San"); A     Else if(ch=='4') printf ("si"); -     Else if(ch=='5') printf ("Wu"); -     Else if(ch=='6') printf ("Liu"); the     Else if(ch=='7') printf ("Qi"); -     Else if(ch=='8') printf ("BA"); -     Else if(ch=='9') printf ("JIU"); -  + } - intMain () + { A     Chars[ +]; atCin>>s; -     inti,len=strlen (s); -      for(i=0; i<len-1; i++) -     { - print (s[i]); -printf" "); in     } -Print (s[len-1]); toprintf"\ n"); +     return 0; -}

PAT Group Programming Ladder-practice set l1-007. Read the numbers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.