From: assemblywizard@gmail.com   
      
   This will get you started, hey is this a class assignment?    
      
   Anyway, I have corrected some of your mistakes, if you want to   
   repetitively call gettime in the loop and dump the delay which is   
   serving as a timer--I leave that to you...   
   program test;   
   uses dos,crt;   
      
   var   
    h,m,s,c,seed,cent,sec,min: word;   
      
   begin   
    clrscr;   
    gettime(h,m,s,seed);   
    cent := 0;   
    sec := 0;   
    min := 0;   
    gettime(h,m,s,c);   
    cent :=c+(100-seed);   
    repeat   
    cent := cent + 1;   
    if cent > 100 then   
    begin   
    cent := 0;   
    sec := sec + 1;   
    end;   
    if sec > 60 then   
    begin   
    sec := 0;   
    min := min + 1;   
    end;   
    if min > 60 then   
    begin   
    min := 0;   
    h := h + 1;   
    end;   
    gotoxy(10,10);   
    write(' ');   
    gotoxy(10,10);   
    write(integer(h),':',integer(min),':',integer(sec),':',integer(cent));   
    delay(10);   
    until keypressed;   
    writeln;   
   end.   
      
   Warmest regards,   
   John   
      
    wrote in message   
   news:1117585253.045135.19000@g43g2000cwa.googlegroups.com...   
   > Hello (my first post here),   
   > Im doing a simple (I believe it is) chronometer in Pascal, the idea   
   > is to get a seed before running the chrono (seed is from   
   > gettime(h,m,s,seed) in my example) and then the program increment one   
   > second each time the cent inside repeat is equal to 99. But the   
   > problem   
   > is: when I increment sec it doesnt add just +1, it adds like 500, 300,   
   > etc.   
   >   
   > What I've done:   
   >   
   > program test;   
   > uses dos,crt;   
   >   
   > var   
   > h,m,s,c,seed,cent,sec,min: word;   
   >   
   > begin   
   > clrscr;   
   >   
   > gettime(h,m,s,seed);   
   > cent:=0; sec:=0; min:=0;   
   >   
   > repeat   
   > gettime(h,m,s,c);   
   >   
   > if ((c-seed)<0) then   
   > begin cent:=c+(100-seed);   
   > end   
   > else begin   
   > cent:=c-seed;   
   > end;   
   >   
   > if (cent=99) then   
   > sec:=sec+1;   
   >   
   > if (sec=60) then   
   > begin   
   > sec:=0;   
   > min:=min+1;   
   > end;   
   >   
   > gotoxy(10,10);   
   > write(min,':',sec,':',cent);   
   > until keypressed;   
   > writeln;   
   > end.   
   > ------   
   > After 1 sec running I got the following output: 9:55:22   
   >   
   > Someone can help me solve this please ? (I dont want to use delay)   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|