解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h=sc.nextInt(); int m=sc.nextInt(); String a[]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"}; if(h>=0&&h<=20) System.out.print(a[h]+" "); else if(h==21) System.out.print(a[20]+" "+a[1]+" "); else if(h==22) System.out.print(a[20]+" "+a[2]+" "); else if(h==23) System.out.print(a[20]+" "+a[3]+" "); else if(h==24) System.out.print(a[20]+" "+a[4]+" "); if(m==0){ System.out.print("o'clock"); } else if(m>0&&m<=20) System.out.print(a[m]); else if(m>20&&m<30) System.out.print(a[20]+" "+a[m-20]); else if(m==30) System.out.print("thirty"); else if(m>30&&m<40) System.out.print("thirty "+a[m-30]); else if(m==40) System.out.print("forty"); else if(m>40&&m<50) System.out.print("forty "+a[m-40]); else if(m==50) System.out.print("fifty"); else if(m>50&&m<60) System.out.print("fifty "+a[m-50]); } }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)for循环浏览:1178 |
C语言训练-计算:t=1-1/(2*2)-1/(3*3)-...-1/(m*m) (C语言代码)浏览:799 |
大小写转换 (C语言代码)浏览:904 |
数组输出 (C语言代码)--此题的题目描述有问题浏览:1844 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:644 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:660 |
WU-小九九 (C++代码)浏览:1713 |
【金明的预算方案】 (C++代码)浏览:873 |
C二级辅导-同因查找 (C语言代码)浏览:618 |
Hello, world! (C语言代码)浏览:916 |