ini adalah beberapa program pascal yg sudah di gabung menjadi satu program..
Program gabungan; uses wincrt; var nama : string; pilihan : integer; panjang,lebar,sisi,sisi1,luas,sisi3 : longint; alas,tinggi,luas1,jari2 : real ; jenis_luas : integer; hari,jam,detik,sisa_detik,menit : longint; tahun,bulan,sisa_hari : longint; tgl1,tgl2,bln1,bln2,thn1,thn2,tgl,bln,thn,jumlah_hari : integer; x,y,z : integer; uang,seribu,limaratus,seratus,limpul,dualima : longint; cm,km,m,sisa_cm : longint; inchi,kaki,yard : real; meter : longint; tinggib,berat,berat1,berat2,berat3 : integer; ulang : string; label awal,1,2,3,4,5,6,7,8,9,10; begin awal: clrscr; writeln('================================================================================'); writeln(' MENU UTAMA PROGRAM PASCAL'); writeln('================================================================================'); writeln(' --------------------------------------------------------'); writeln(' : 1. Program Nama :'); writeln(' : 2. Program hitung luas bangun :'); writeln(' : 3. Program konversi dari detik :'); writeln(' : 4. Program konversi dari Hari :'); writeln(' : 5. Program hitung jarak antara tangal :'); writeln(' : 6. Program tukar nilai :'); writeln(' : 7. Program uang pecahan :'); writeln(' : 8. Program konversi dari cm ke km,m,cm:'); writeln(' : 9. Program konversi dari m ke inchi,kaki,yard :'); writeln(' : 10.Program berat badan ideal :'); writeln(' --------------------------------------------------------'); write(' Masukan pilihan anda (1-10): ');readln(pilihan); begin if(pilihan > 11) or (pilihan < 1) then goto awal end; if (pilihan)=1 then begin 1: clrscr; gotoxy(30,2); writeln(' Program Perkenalan Nama'); writeln(' '); writeln('--------------------------------------------------------------------------------'); writeln(' Halo siapa nama kamu ?'); write(' '); readln(nama); clrscr; gotoxy(30,2); writeln(' Program Perkenalan Nama'); writeln(' '); writeln('--------------------------------------------------------------------------------'); writeln(' Senang berteman denganmu ',nama); writeln(' '); writeln('--------------------------------------------------------------------------------'); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 1 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=2 then begin 2: clrscr; writeln('--------------------------------------------------------------------------------'); writeln(' 1.hitung bujur sangkar '); writeln(' 2.hitung lingkaran '); writeln(' 3.hitung segitiga '); writeln(' 4.hitung trapesium '); writeln(' 5.hitung persegi panjang '); writeln('--------------------------------------------------------------------------------'); gotoxy(10,9);write('masukan type luas yang akan dihitung (1-5) = ');readln(jenis_luas); if (jenis_luas > 5) or (jenis_luas < 1) then goto 2 end; if ( jenis_luas= 1) then begin gotoxy(10,11);writeln('Anda memilih Luas Bujur Sangkar '); write('Masukan sisi = '); readln(sisi); luas:=sisi * sisi; writeln(' Luas = ',luas); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 2 else if (ulang='n') or (ulang='N') then goto awal; end; if ( jenis_luas= 2) then begin gotoxy(10,11);write('Anda memilih Luas lingkaran '); gotoxy(2,15); write('Masukan jari - jari = '); readln(jari2); luas1:=22/7 * (jari2*jari2); writeln(' luas lingkaran = ',luas1:4:2); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 2 else if (ulang='n') or (ulang='N') then goto awal; end; if ( jenis_luas= 3) then begin gotoxy(10,11); write('Anda memilih Luas segitiga '); gotoxy(2,15); write('Masukan alas = '); readln(alas); write(' Masukan tinggi = '); readln(tinggi); luas1:=1/2*alas*tinggi; writeln(' Luas segitiga adalah = ',luas1:4:2); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 2 else if (ulang='n') or (ulang='N') then goto awal; end; if ( jenis_luas= 4) then begin gotoxy(10,11); write('Anda memilih Luas Trapesium '); gotoxy(2,15); write('Masukan sisi a = '); readln(sisi); write(' masukan sisi b = '); readln(sisi1); sisi3:=sisi+sisi1; luas1:=sisi3/2; writeln(' Luas trapesium = ',luas1:4:2); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 2 else if (ulang='n') or (ulang='N') then goto awal; end; if ( jenis_luas= 5) then begin gotoxy(10,11); write('Anda memilih Luas Persegi Panjang '); gotoxy(2,15); write('Masukan panjang = ');readln(panjang); write(' Masukan lebar =' );readln(lebar); luas:=panjang*lebar; writeln(' Luas persegi panjang adalah = ',luas); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 2 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=3 then begin 3: clrscr; writeln('================================================================================'); writeln(' Program Konversi dari detik'); writeln; writeln('================================================================================'); write('masukan jumlah detik ='); readln(detik); hari:=detik div 86400; jam:=detik mod 86400 div 3600; menit:=detik mod 86400 mod 3600 div 60; sisa_detik:=detik mod 86400 mod 3600 mod 60; writeln; writeln(' ',hari,' Hari ',jam,' Jam ',menit,' Menit ',sisa_detik,' Detik '); writeln('================================================================================'); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 3 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=4 then begin 4: clrscr; writeln('================================================================================'); writeln(' Program Konversi dari Hari'); writeln; writeln('================================================================================'); write('masukan jumlah hari ='); readln(hari); tahun:=hari div 365; bulan:=hari mod 365 div 30; sisa_hari:=hari mod 365 mod 30; writeln(' '); writeln(tahun,' Tahun ',bulan,' Bulan ',sisa_hari,' Hari '); writeln('--------------------------------------------------------------------------------'); writeln; writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 4 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=5 then begin 5: clrscr; writeln('================================================================================'); writeln(' Program Hitung Jarak Antar Tanggal'); writeln; writeln('================================================================================'); write('tanggal 1 : '); writeln(' '); write('masukan tanggal = ');readln(tgl1); write('masukan bulan = '); readln(bln1); write('masukan tahun = '); readln(thn1); writeln(' '); write('tanggal 2 :'); writeln(' '); write('masukan tanggal = ');readln(tgl2); write('masukan bulan = ');readln(bln2); write('masukan tahun = '); readln(thn2); jumlah_hari:=(thn2-thn1)*365+(bln2-bln1)*30+(tgl2-tgl1); thn:=jumlah_hari div 365; bln:=jumlah_hari mod 365 div 30; tgl:=jumlah_hari mod 365 mod 30; writeln(thn,' tahun ',bln,' bulan ',tgl,' hari '); writeln('--------------------------------------------------------------------------------'); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 5 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=6 then begin 6: clrscr; writeln('================================================================================'); writeln(' Program Tukar nilai X Y Z'); writeln; writeln('================================================================================'); write(' masukan nilai x = ');readln(x); write(' masukan nilai y = ');readln(y); write(' masukan nilai z = ');readln(z); writeln(' '); writeln(' nilai sebelum di ubah :'); writeln(' '); writeln(' x = ',x); writeln(' y = ',y); writeln(' z = ',z); writeln(' '); writeln(' '); writeln('nilai setelah di ubah :'); writeln(' '); writeln(' x = ',y); writeln(' y = ',z); writeln(' z = ',x); writeln('--------------------------------------------------------------------------------'); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 6 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=7 then begin 7: clrscr; writeln('================================================================================'); writeln(' Program Hitung Uang Pecahan'); writeln; writeln('================================================================================'); write('Masukan jumlah uang = '); readln(uang); seribu:=uang div 1000; limaratus:=uang mod 1000 div 500; seratus:=uang mod 1000 mod 500 div 100; limpul:=uang mod 1000 mod 500 mod 100 div 50; dualima:=uang mod 1000 mod 500 mod 100 mod 50 div 25; writeln(' '); writeln('Uang pecahan adalah'); writeln; writeln(' => ',seribu, ' uang pecahan Rp.1000'); writeln(' => ',limaratus,' uang pecahan Rp. 500'); writeln(' => ',seratus,' uang pecahan Rp. 100'); writeln(' => ',limpul,' uang pecahan Rp. 50'); writeln(' => ',dualima,' uang pecahan Rp. 25'); writeln('--------------------------------------------------------------------------------'); writeln; writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 7 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=8 then begin 8: clrscr; writeln('================================================================================'); writeln(' Program Hitung Konverter dari (cm)'); writeln; writeln('================================================================================'); write(' Masukan jarak (cm) = '); readln(cm); km:=cm div 100000; m:=cm mod 100000 div 100; sisa_cm:=cm mod 100000 mod 100; writeln(' jarak yang di tempuh adalah = '); writeln; writeln(' ',km,' (km) '); writeln(' ',m,' (m) '); writeln(' ',sisa_cm,' (cm) '); writeln; writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 8 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=9 then begin 9: clrscr; writeln('================================================================================'); writeln(' Program konversi dari meter '); writeln; writeln('================================================================================'); write(' masukan meter (m) = '); readln(meter); writeln(' '); inchi:=meter/0.254; kaki:=meter/0.3048; yard:=meter/0.9144; writeln(' inchi = ',inchi:2:2); writeln(' kaki = ',kaki:2:2); writeln(' yard = ',yard:2:2); writeln(' '); writeln('--------------------------------------------------------------------------------'); writeln; writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 6 else if (ulang='n') or (ulang='N') then goto awal; end; if (pilihan)=10 then begin 10: clrscr; writeln('================================================================================'); writeln(' Program Penghitung Berat Badan Ideal'); writeln; writeln('================================================================================'); write('Masukan tinggi badan anda = '); readln(tinggib); berat:=tinggib - 100; berat1:=berat * 10; berat2:=berat1 div 100; berat3:=berat - berat2; writeln('Berat ideal anda adalah ',berat3); writeln('--------------------------------------------------------------------------------'); writeln; writeln(' Apakah anda ingin mengulang ? Y/N'); write(' Y/N : '); readln(ulang); if (ulang='Y')or (ulang='y') then goto 10 else if (ulang='n') or (ulang='N') then goto awal; end; end.
:JAL:
ConversionConversion EmoticonEmoticon