不明白了。。。实在也找不出来喃!
人在江湖【走】,怎能不挨【刀】;为了能活【口】,唯有把己【超】!come on...
这是我编的程序, 交的时候说我有360个错误答案!我自己已经找了很久!但是我还是没有找到那些输出的答案是错误的!我真是快要崩溃了!
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
int hour, minute;
float t;
scanf("%d%d", &hour, &minute);
while(hour!=0 || minute!=0)
{
if(hour>12 || hour < 1 || minute >=60 || minute < 0)
break;
t=fabs(hour*30+minute/2.0-minute*6); //改为2.0,不然小数部分没了
if(t>=180 && minute >= 10)
printf("At %d:%d the angle is %.1f degrees.\n",hour, minute, 360-t);
else if(t>=180 && minute < 10)
printf("At %d:0%d the angle is %.1f degrees.\n",hour, minute, 360-t);
else if(t<180 && minute >= 10)
printf("At %d:%d the angle is %.1f degrees.\n",hour, minute, t);
else if(t<180 && minute<10)
printf("At %d:0%d the angle is %.1f degrees.\n",hour, minute, t);
scanf("%d%d", &hour, &minute);
}
return 0;
}