Back To Top

Naruto VS Sasuke,who is the strongest?

Monday, 30 June 2014

loop bahasa pascal

Program Output_Tengah_Tengah_Layar; 
 
Uses crt;
Var
  Xtengah, XGerak, N, I : Byte;
  Lagi : Char;
Begin
  Lagi:='Y';
  While (Upcase(Lagi)='Y') Do
     Begin
       clrscr;
       writeln('Banyak N : ');
       readln(N);
       A:=1;
       For I:=1 To N Do
          Begin
              K:=1;
             XGerak:=Xtengah;
             While (K<=A) Do
                Begin
                    Gotoxy(XGerak,I-1);
                    XGerak:=XGerak+1;
                    K:=K+1;
                End; {Akhir For J}
              XTengah:=XTengah-1;
              A:=A+2;
            End; { akhir For I}
            writeln;
            write('Anda Ingin Mencetak Lagi  : ');
            readln(Lagi);
        End; {Akhir while}
End.
 
 
layout :
                                       1
                                      111
                                     11111
                                    111111 

PROCEDURE DALAM MESIN MULTIFUNGSI

Pengkodean dengan struktur parameter (Procedure)
 
PROGRAM DATA_BARANG;
USES WINCRT;
VAR
ULANG : CHAR;
PILIH : STRING;
PROCEDURE MULAI;
BEGIN
WRITELN('KODE JENIS BARANG');
WRITELN('---------------------------------------------------');
WRITELN('* B11 [SEMBAKO] - B12 [MAKANAN] - B13 [MINUMAN] *');
WRITELN('---------------------------------------------------');
WRITELN;
WRITE('PILIH JENIS DATA BARANG : ');READLN(PILIH);
END;
PROCEDURE SEMBAKO;
VAR
KDBR : STRING;
KET1 : LONGINT;
BEGIN
CLRSCR;
WRITELN('KATEGORI SEMBAKO');
WRITELN;
WRITELN('DAFTAR KODE BARANG : ');
WRITELN('------------------------------------------');
WRITELN('BR-001 [SABUN MANDI] BR-002 [SABUN CUCI ]');
WRITELN('BR-003 [TERIGU ] BR-004 [MINYA GORENG]');
WRITELN('------------------------------------------');
WRITELN;
WRITE('KODE BARANG : ');READLN(KDBR);
IF KDBR = 'BR-001' THEN
BEGIN
WRITELN('NAMA BARANG : SABUN MANDI');
KET1 :=2500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 1');
WRITELN('STOK : 10 BTG');
END;
IF KDBR = 'BR-002' THEN
BEGIN
WRITELN('NAMA BARANG : SABUN CUCI');
KET1 :=3500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 1');
WRITELN('STOK : 5 BKS');
END;
IF KDBR = 'BR-003' THEN
BEGIN
WRITELN('NAMA BARANG : TERIGU');
KET1 :=2300;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 2');
WRITELN('STOK : 10 KG');
END;
IF KDBR = 'BR-004' THEN
BEGIN
WRITELN('NAMA BARANG : SABUN CUCI');
KET1 :=3500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 2');
WRITELN('STOK : 5');
END;
END;
PROCEDURE MAKANAN;
VAR
KDBR : STRING;
KET1 : LONGINT;
BEGIN
CLRSCR;
WRITELN('KATEGORI MAKANAN');
WRITELN;
WRITELN('DAFTAR KODE BARANG : ');
WRITELN('--------------------------------------------');
WRITELN('BR-005 [WAFER NISSIN] BR-006 [KACANG GARUDA]');
WRITELN('BR-007 [SARI ROTI ] BR-008 [KHONG GUAN ]');
WRITELN('--------------------------------------------');
WRITELN;
WRITE('KODE BARANG : ');READLN(KDBR);
IF KDBR = 'BR-005' THEN
BEGIN
WRITELN('NAMA BARANG : WAFER NISSIN');
KET1 :=12500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 3');
WRITELN('STOK : 5 KLG');
END;
IF KDBR = 'BR-006' THEN
BEGIN
WRITELN('NAMA BARANG : KACANG GARUDA');
KET1 :=1500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 3');
WRITELN('STOK : 10 PAK');
END;
IF KDBR = 'BR-007' THEN
BEGIN
WRITELN('NAMA BARANG : SARI ROTI');
KET1 :=2500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 3');
WRITELN('STOK : 20 BKS');
END;
IF KDBR = 'BR-008' THEN
BEGIN
WRITELN('NAMA BARANG : KHONG GUAN');
KET1 :=25000;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 2');
WRITELN('STOK : 5 KLG');
END;
END;
PROCEDURE MINUMAN;
VAR
KDBR : STRING;
KET1 : LONGINT;
BEGIN
CLRSCR;
WRITELN('KATEGORI MINUMAN');
WRITELN;
WRITELN('DAFTAR KODE BARANG : ');
WRITELN('----------------------------------------------');
WRITELN('BR-009 [COCA-COLA ] BR-010 [TEH PUCUK ]');
WRITELN('BR-011 [POCARI SWEAT] BR-012 [LARUTAN PENYEGAR]');
WRITELN('----------------------------------------------');
WRITELN;
WRITE('KODE BARANG : ');READLN(KDBR);
IF KDBR = 'BR-009' THEN
BEGIN
WRITELN('NAMA BARANG : COCA-COLA');
KET1 :=12500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 4');
WRITELN('STOK : 7 BTL');
END;
IF KDBR = 'BR-010' THEN
BEGIN
WRITELN('NAMA BARANG : TEH PUCUK');
KET1 :=1500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 4');
WRITELN('STOK : 5 BTL');
END;
IF KDBR = 'BR-011' THEN
BEGIN
WRITELN('NAMA BARANG : POCARI SWEAT');
KET1 :=2500;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 4');
WRITELN('STOK : 8 BTL');
END;
IF KDBR = 'BR-012' THEN
BEGIN
WRITELN('NAMA BARANG : LARUTAN PENYEGAR');
KET1 :=25000;
WRITELN('HARGA : ',KET1);
WRITELN('lOKASI : RAK 4');
WRITELN('STOK : 5 KLG');
END;
END;
BEGIN
ULANG := 'Y';
WHILE ULANG = 'Y' DO
BEGIN
CLRSCR;
WRITELN(' PROGRAM DATA BARANG');
WRITELN(' TOKO BERKAH MAKMUR GROSIR DAN ECERAN');
WRITELN('ALAMAT : JL. KHZ. MUSTHAFA NO. 22 SUKAHIDENG-SUKARAPIH-TASIKMALAYA 43364');
WRITELN('=======================================================================');
WRITELN('Struktur Procedure Kelompok 2 © 2013');
WRITELN('=======================================================================');
WRITELN;
MULAI;
IF PILIH ='B11' THEN
BEGIN
SEMBAKO
END;
IF PILIH ='B12' THEN
BEGIN
MAKANAN
END;
IF PILIH ='B13' THEN
BEGIN
MINUMAN
END;
WRITELN;
WRITE('APAKAH AKAN MENGULANG PENCARIAN DATA Y/T ? ');READLN(ULANG);
IF ULANG = 'T' THEN
DONEWINCRT;
END;
END.
 
layout 
 

Visitor

Powered by Blogger.

Labels

Copyright © 2012 Bebin Cahyadi | Naruto Vs Sasuke V2 Theme | Designed by Johanes DJ