Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculate the degrees that form between the hands of a clock
#1
REM "ESTE PROGRAMA CALCULA LOS GRADOS APROX. QUE FORMAN ENTRE LAS AGUJAS DE UN RELOJ DE 12 HORAS"

REM "THIS PROGRAM CALCULATE THE GRADES APROX. ARE FORMING BETWEEN THE NEEDLES OF A 12-HOUR CLOCK"

REM "LRCVS 09.08.08"

Attention:
The programme for the calculus that copy dated 07.08.08 was wrong.

>>>>>>>This is the correct program

cls
'aqui solicitamos la hora
'here when asked hour
input "hora / hour ( hhmmss ) = "; hini$

'aqui comprobamos su longitud
'here we see their length
lhini = len(hini$)
if lhini < 6 then cls : print "error": beep

'aqui comprobamos y ajustamos horarios de 24 hor
'here check and adjust schedules of 24 hours
hor$ = left$(hini$, 2)
if val(hor$) > 24 then print "error": beep
if val(hor$) = 24 then hor$ = "00"

'aqui comprobamos y ajustamos horarios de 12 hor
'here check and adjust schedules of 12 hours
if val(hor$) > 12 then hor$ = ltrim$(str$((val(hor$) - 12)))
if val(hor$) = 12 then hor$ = "00"

'aqui comprobamos los minutos
'here we check the minutes
min$ = mid$(hini$, 3, 2)
if val(min$) > 59 then print "error": beep

'aqui comprobamos los segundos
'here we check the second                           
seg$ = right$(hini$, 2)
if val(seg$) > 59 then print "error": beep

'aqui calculamos los segundos que tienen las horas, minutos, segundos
'here we estimate that the latter are the hours, minutes, seconds
seghor# = val(hor$) * 60 * 60
segmin# = val(min$) * 60
segseg# = val(seg$) * 1

'aqui calculamos los segundos totales
'here we estimate total seconds
segtot# = seghor# + segmin# + segseg#

'esto son los segundos que hay en 12 hor
'This is the second there in 12 hours
segtot360# = 43200

'aqui calculamos el angulo que hace la aguja de las horas
'here we calculate the angle that makes the needle of Hours
anghor# = (360 * (seghor# + segmin# + segseg#)) / segtot360#

'aqui calculamos el angulo que hace la aguja de los minutos
'here we calculate the angle that makes the needle minutes
angmin# = ((360 * (segmin# + segseg#)) / segtot360#) * 12

'aqui calculamos la diferencia entre el angulo de las horas y el de los minutos
'here we calculate the difference between the corner of the hours and minutes
angtot# = abs((anghor#) - angmin#)

ag = int(angtot#)

b = angtot# - ag
mn = int((b * 60))

c = b * 60
d = c - int©
e = d * 60

print
'Total corner between needles ="
print "angulo total entre agujas = "; angtot#; " grd"

print
'Also =
print "tambien = "; ag; " grd "; mn; " min "; e; " seg"




Reply


Messages In This Thread
Calculate the degrees that form between the hands of a clock - by lrcvs - 08-07-2008, 10:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)