Membuat Konversi Terbilang di Pascal

Berikut contoh membuat Konversi terbilang di Pascal.........

Semoga Bermanfaat,...... :)



uses crt;

procedure huruf(a:integer);
begin
case a of
1:write(' se');
2:write(' dua ');
3:write(' tiga ');
4:write(' empat ');
5:write(' lima ');
6:write(' enam ');
7:write(' tujuh ');
8:write(' delapan ');
9:write(' sembilan ');
end;
end;

procedure proses;
var i,j,x:integer;
begin
readln(x);
writeln;

gotoxy(15,9);
write('Terbilang :');
if x<10000 then
begin
 if x>=1 then
 begin
    if x>=1000 then
    begin
    i:=x div 1000;
    huruf(i);write('ribu');
    j:=x mod 1000; x:=j;
    end;

    if x>=100 then
    begin
    i:=x div 100;
    huruf(i);write('ratus');
    j:=x mod 100; x:=j;
    end;

    if x div 10=1 then
    begin
       if x mod 10=0 then
       begin
       write('sepuluh');
       end
       else
       begin
       i:=x mod 10;
       huruf(i);
       write('belas');
       end;
    end;

    if x>=20 then
    begin
    i:=x div 10;
    huruf(i);write('puluh');
    j:=x mod 10; x:=j;
    end;

    if x<10 then
    begin
       if x=1 then
       begin
       write(' satu');
       end
       else
       begin
       huruf(x);
       end;
    end;
 end
 else
 writeln('Sorry!! angka belum dapat dikonversikan');
end
else
begin
writeln('Sorry!! angka belum dapat dikonversikan');
end;
end;

procedure ulang;
var lagi:char;
begin
repeat
gotoxy(15,2); write('.............................................');
gotoxy(15,3); write('...        Program Konversi Angka         ...');
gotoxy(15,4); write('... Angka masukkan diantara 1 sampai 9999 ...');
gotoxy(15,5); write('.............................................');
gotoxy(15,7); write('Masukkan angka yang akan anda konversi : ');
proses;

gotoxy(15,14);write('Ingin konversi lagi(y/t) ');
read(lagi);
clrscr;
until lagi='t';

end;

procedure anim;
var i,j:integer;
begin
for j:=1 to 5 do
begin
gotoxy(25,9); writeln('-------------------------------------');
gotoxy(25,10);  write('   -- ');
gotoxy(50,10);  write('        --');
gotoxy(25,11);writeln('--                                 --');
gotoxy(25,12);writeln('-- PLEASE WAIT.........            --');
gotoxy(25,13);writeln('--                                 --');
gotoxy(25,14);writeln('-- created, WASIS PANCORO 672012210--');
gotoxy(25,15);writeln('-------------------------------------');
gotoxy(29,10);

        for i:=1 to 30 do
        begin
        delay(70);
        textColor(i);
        write(#220);
        end;
        clrscr;

end;
end;
begin
clrscr;
anim;
ulang;
end.




output :






terima kasih sudah berkunjung,,,,,,,
semoga bermanfaat....
tinggalin jempolnya y.... :)

0 komentar:

Copyright © 2013 Gagal Coding