24进制时间转化为12进制时间

我这段写的怎么分钟总是显示错误啊,是哪里的问题 求大神指教。int main(void) { int h,m,a; a=h-12; printf("Enter a 24-hour time:"); scanf("%d:%d",&h,&m); switch(h) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: printf("Equivalent 12-hour time:%d:%d AM",h, m);break; case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: printf("Equivalent 12-hour time:%d:%d PM",a,m);break; case 0 : printf("Equivalent 12-hour time:12:%d AM",m);break; } return 0; }
支离益
浏览 1582回答 2
2回答

望远

#include<stdio.h>int main(void) {  int h,m,a;  printf("Enter a 24-hour time:");  scanf("%d:%d",&h,&m);  a=h-12;  switch(h) { case 1: case 2:  case 3: case 4:  case 5: case 6:  case 7: case 8:  case 9: case 10:  case 11: case 12:  printf("Equivalent 12-hour time:%d:%d AM\n",h, m);break; case 13: case 14:  case 15: case 16:  case 17: case 18:  case 19: case 20:  case 21: case 22:  case 23:  printf("Equivalent 12-hour time:%d:%d PM\n",a,m);break;  case 0 :  printf("Equivalent 12-hour time:12:%d AM",m);break; }  return 0; }这样吗??

JustWannaHugU

你这排版看着真心难受咱提问题也得认真点吧。。
打开App,查看更多内容
随时随地看视频慕课网APP