Pascal/Turbo Pascal - Reloj en Turbo Pascal

 
Vista:

Reloj en Turbo Pascal

Publicado por Spanky (1 intervención) el 03/04/2016 00:25:14
Llevo esto del programa y no me sale bien las horas, me marca como si fueran los minutos ¿en que estoy mal?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
program Reloj;
uses crt;
var seg,min,hor: Integer;
begin
clrscr;
seg:=1;
min:=0;
hor:=0;
repeat
gotoxy (40,12);
write (hor,' : ', min,' : ',seg);
seg:=seg+1;
delay (100);
if seg=60 then
begin
seg:=0;
min:=min+1;
hor:=hor+1;
clrscr;
end;
if min=60 then
min:=0;
if hor=23 then
hor:=0;
until keypressed;
end.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Reloj en Turbo Pascal

Publicado por ramon (2158 intervenciones) el 04/04/2016 11:33:13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{Mira esto a ver si te funciona y otro modo }
 
program Reloj;
uses crt;
var seg,min,hor: Integer;
begin
clrscr;
seg:=1;
min:=0;
hor:=0;
repeat
gotoxy (40,12);
write (hor,' : ', min,' : ',seg);
seg:=seg+1;
delay (959);
if seg > 59 then
begin
  seg := 0;
  min := min + 1;
  if min > 59 then
  begin
    min := 0;
    hor := hor + 1;
    if hor = 23 then
    hor := 0;
  end;
   clrscr;
 end;
until keypressed;
end.
 
{program relog;
 uses
    crt, dos;
  var
    h, m, s, sem : Word;
 
  function ponemoscero(c : word) : string;
  var
    cade : string;
    begin
       str(c:0,cade);
       if Length(cade) = 1 then
       cade := '0' + cade;
      ponemoscero := cade;
    end;
 
   procedure elrelog;
   begin
     repeat
      gettime(h,m,s,sem);
      gotoxy(35,12);Write(ponemoscero(h),':',
          ponemoscero(m),':',ponemoscero(s));
     until keypressed;
    end;
 
   begin
      clrscr;
      elrelog;
   end.}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar