C语言问题C语言问题

2025-01-21 00:58:00
推荐回答(1个)
回答1:

#include  
int main()
{char num[24][10]={"zero","one","two","three","four","five",
 "six","seven","eight","nine","ten","eleven","twelve","thirteen",
 "fourteen","fifteen","sixteen","seventeen","eighteen","nineteen",
 "twenty","thirty","forty","fifty"};
 int h,m;
 scanf("%d%d",&h,&m);
 printf("%s",num[h]);
 if(m>0)
   {if(m<21)printf(" %s",num[m]);
      else 
  {printf(" %s",num[m/10+18]);
   if(m%10>0)printf(" %s",num[m%10]);
      }
   }
 else printf(" o'clock");
 printf("\n");
 return 0;
}