如果在北京时间12点00分运行以下代码,程序的输出是 Sub Procedure() If Hour(Time())>=8 And Hour(Time())12 And Hour(Time())

admin2020-06-06  23

问题 如果在北京时间12点00分运行以下代码,程序的输出是
    Sub Procedure()
    If Hour(Time())>=8 And Hour(Time())<=12Then
    Debug.Print"上午好!"
    Else If Hour(Time())>12 And Hour(Time())<=18Then
    Debug.Print"下午好!"
    Else
    Debug.Print"欢迎下次光临!"
    End If
    End Sub

选项 A、欢迎下次光临!
B、上午好!
C、下午好!
D、无输出

答案B

解析 Time()函数可以返回系统当前时间,Hour(Time())可以返回系统当前时间的小时,本程序中的if~elseif多分支判断语句,判断系统当前时间的小时值,如果在8到12点之间(含8点和12点),则输出“上午好”,如果在12点到18点之间(含18点),则输出“下午好”,除此之外输出“晚上好”,因为当前系统时间为12点,所以输出“上午好”,所以选项B正确。
转载请注明原文地址:https://kaotiyun.com/show/TIcp777K
0

相关试题推荐
最新回复(0)