小学生拔河比赛规则:谁把这个代码翻译一下

来源:百度文库 编辑:神马品牌网 时间:2024/05/29 17:25:49
print amPmTime$(time$())

function amPmTime$(time$)

colonIndex = instr(time$, ":")
hours = val(left$(time$, colonIndex - 1))
amOrPm$ = " AM"
if hours > 12 then
hours = hours - 12
amOrPm$ = " PM"
else
if hours = 0 then hours = 12
end if
amPmTime$ = str$(hours) + mid$(time$, colonIndex) + amOrPm$

end function
PRINT "HH HH BBBBBB YY YY LL"
PRINT "HH HH BB BB YY YY LL"
PRINT "HH HH BB BB YY YY LL"
PRINT "HHHHHHH BBBBBBB YYY LL"
PRINT "HH HH BB BB YYY LL"
PRINT "HH HH BB BB YYY LL"
PRINT "HH HH BBBBBB YYY LLLLLLLLL"
print amPmTime$(time$())
function amPmTime$(time$)
colonIndex = instr(time$, ":")
hours = val(left$(time$, colonIndex - 1))
amOrPm$ = " AM"
if hours > 12 then
hours = hours - 12
amOrPm$ = " PM"
else
if hours = 0 then hours = 12
end if
amPmTime$ = str$(hours) + mid$(time$, colonIndex) + amOrPm$
end function