Wednesday, November 7, 2012

Stopwatch Sederhana mengunakan Free Pascal (DDP 2012)

  No comments
uses crt;

var i : integer;
    m : integer = 59;

function menit() : integer; forward;

procedure detik();
 begin
    if m <> 0 then
       begin
            for i := 59 downto 1 do
                begin clrscr;
                    write('Counter Down : ');
                    if m = 0 then
                        begin
                        break;
                    end
                else
                if i = 1 then
                    begin
                        menit();
                    end
                else
                    begin
                        write(m,':');
                        write(i); delay(1000);
                    end
                end;

        end
    else
        begin
            writeln('Waktu Selesai');
            exit;
        end

    end;

function menit() : integer;
    begin
        m := m -1;
        menit := m;
        detik();
    end;


begin clrscr;
    detik();
    readkey;
end.

No comments :