C language · Chime Assistant

Source: Internet
Author: User

Time limit for basic exercise repeater: 1.0s memory limit: 512.0MBKam sac 1 judgment, string Output. Kam SAC 2 as required output, to determine the special Situation. The problem description is given the current time, please read it in English.
Time elapsed H and Min m indicate that in English reading, the method of reading a time is:
If M is 0, it will be read out, then add "o ' clock", such as 3:00 reading "three o ' clock".
If M is not 0, it will be read out and then read out, such as 5:30 reading "five thirty".
The reading of hours and minutes is the method of reading the English numerals, in which 0~20 read as Follows:
0:zero, 1:one, 2:two, 3:three, 4:four, 5:five, 6:six, 7:seven, 8:eight, 9:nine, 10:ten, 11:eleven, 12:twelve, 13:thirteen , 14:fourteen, 15:fifteen, 16:sixteen, 17:seventeen, 18:eighteen, 19:nineteen, 20:twenty.
30 read as thirty,40 read as forty,50 read as Fifty.
For numbers greater than 20 and less than 60, first read the number of 10, and then add the single digit. If 31 read the first 30 plus 1 reading, read as "thirty one".
Read as "twenty one fifty four" according to the above rules 21:54, 9:07 read "nine seven", 0:15 read "zero fifteen". Input format input contains two non-negative integers h and m, representing time and Minutes. Non-zero digits are preceded by no leading 0. H is less than 24,m less than 60. Output format output time in English. Sample Input 0 15 example output zero fifteen code one:
1 /*2 0:zero, 1:one, 2:two, 3:three, 4:four, 5:five3 6:six, 7:seven, 8:eight, 9:nine, 10:ten, 11:eleven4 12:twelve, 13:thirteen, 14:fourteen, 15:fifteen5 16:sixteen, 17:seventeen, 18:eighteen, 19:nineteen6 20:twenty, 30:thirty,40:forty,50:fifty. 7 8 for numbers greater than 20 and less than 60, first read the number of 10, and then add the single digit. 9 If 31 read the first 30 plus 1 reading, read as "thirty one". Ten follow the rules above: one 21:54 read as "twenty one fifty four"; a 9:07 read as "nine seven"; - 0:15 read as "zero fifteen".  - */ the#include <stdio.h> - intmain () { -     Chara[ +][ -]={"Zero"," one"," both","three"," four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen","Twenty"};  -     Charb[6][ -]={"","","Twenty","Thirty","Forty","Fifty"}; +     inth,m; -scanf"%d%d",&h,&m); +     if(m==0){   a         if(h<= -) atprintf"%s o ' clock", a[h]); -         Else -printf"%s%s", b[h/Ten],a[h%Ten]); -}Else{ -         if(h<= -){ -             if(m<= -){ inprintf"%s%s", a[h],a[m]); -}Else{ toprintf"%s %s%s", a[h],b[m/Ten],a[m%Ten]);  +             } -}Else{ the             if(m<= -){   *printf"%s %s%s", b[h/Ten],a[h%Ten],a[m]);  $}Else{Panax Notoginsengprintf"%s %s%s%s", b[h/Ten],a[h%Ten],b[m/Ten],a[m%Ten]);  -             }   the         }   +     }   a     return 0;  the}

Code two:

1#include <stdio.h>2 void(intnumber ) {3     Charn[ -][ -]={"Zero"," one"," both","three"," four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen","Twenty",4     "Thirty","Forty","Fifty"};5     inta=number/Ten;6     intb=number%Ten;7     if(number<= -){8printf"%s", n[number]);9}Else{Ten         if(b!=0){ oneprintf"%s", n[b]); a         } -printf"%s", n[number+ -]); -     } the } - voidTime_ass (intHourintMinu) { -     if(minu==0){//Hour - (hour); +printf"o ' clock"); -}Else{//non-hourly + (hour); aprintf" "); at (minu); -     } - } - intmain () { -     inth,m; -scanf"%d%d",&h,&m); in Time_ass (h,m); -     return 0; to}

C language · Chime Assistant

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.