# 第二周 习题

2016-12-02 12:51:55来源:网络收集作者:Worker人点击

1

UTC是世界协调时，BJT是北京时间，UTC时间相当于BJT减去8。现在，你的程序要读入一个整数，表示BJT的时和分。整数的个位和十位表示分，百位和千位表示小时。如果小时小于10，则没有千位部分；如果小时是0，则没有百位部分；如果分小于10分，需要保留十位上的0。如1124表示11点24分，而905表示9点5分，36表示0点36分，7表示0点7分。

903

103

#include
int main()
{
int hour1,min1,hour2,min2,n,s;
scanf("%d",&n);
if(n>2359)
{
printf("输入错误！/n");
}
hour1=n/1000;
hour2=n/100%10;
min1=n%100/10;
min2=n%10;
if(hour1*10+hour2-8<0)
{
printf("%d/n",hour1*1000+hour2*100+min1*10+min2+1600);
}
else
{
printf("%d/n",hour1*1000+hour2*100+min1*10+min2-800);
}
return 0;
}2

S(Strength)信号强度即大小.

2---Barely readable, occasional words distinguishable

3---Readable with considerable difficulty

4---Readable with practically no difficulty

1---Faint signals, barely perceptible

2---Very weak signals

3---Weak signals

4---Fair signals

5---Fairly good signals

6---Good signals

7---Moderately strong signals

8---Strong signals

9---Extremely strong signals

33

#include
int main()
{
int a,b,n;
scanf("%d",&n);
a=n/10;//**
b=n%10;//*
switch(b)
{
case 1:
printf("Faint signals, barely perceptible,");
break;
case 2:
printf("Very weak signals,");
break;
case 3:
printf("Weak signals,");
break;
case 4:
printf("Fair signals,");
break;
case 5:
printf("Fairly good signals,");
break;
case 6:
printf("Good signals,");
break;
case 7:
printf("Moderately strong signals,");
break;
case 8:
printf("Strong signals,");
break;
case 9:
printf("Extremely strong signals,");
break;

}
switch(a)
{
case 1:
break;
case 2:
printf(" Barely readable, occasional words distinguishable./n");
break;
case 3:
printf(" Readable with considerable difficulty./n");
break;
case 4:
printf(" Readable with practically no difficulty./n");
break;
case 5:
break;
}
return 0;
}