19 Juli 2008

Membuat kuis dengan freepascal

program kuis;
uses crt;
const
skor =0;
var
i:integer;
skor_to:integer;
skor1,skor2,skor3,skor4,skor5,skor6,skor7,skor8,skor9,skor10:integer;
nama:string;
soal1,soal2,soal3,soal4,soal5,soal6,soal7,soal8,soal9,soal10:string;
procedure pertanyaan1;
begin
writeln('pertanyaan pertama');
writeln;
write('siapa nama presiden indonesia pertama:'); read(soal1); readln;
if soal1='soekarno' then
writeln('anda betul')
else
writeln('anda salah');
if soal1='soekarno' then
skor1:=skor+10;
if soal1<> 'soekarno' then
skor1:=skor+0;

readln;
readln;
end;
procedure pertanyaan2;
begin
writeln('pertanyaan kedua');
writeln;
write('siapa runerup piala dunia 1998:'); read(soal2); readln;
if soal2='brazil' then
writeln('anda betul')
else
writeln('anda salah');
if soal2='brazil' then
skor2:=skor+10;
if soal2<> 'brazil' then
skor2:=skor+0;
readln;
end;
procedure pertanyaan3;
begin
writeln('pertanyaan ketiga');
writeln;
write('siapa topskor piala dunia 2002:'); read(soal3); readln;
if soal3='ronaldo' then
writeln('anda betul')
else
writeln('anda salah');
if soal3='ronaldo' then
skor3:=skor+10;
if soal3<> 'ronaldo' then
skor3:=skor+0;
readln;
end;
procedure pertanyaan4;
begin
writeln('pertanyaan keempat');
writeln;
write('siapa nama wakil gubernur jabar:'); read(soal4); readln;
if soal4='dede yusuf' then
writeln('anda betul')
else
writeln('anda salah');
if soal4='dede yusuf' then
skor4:=skor+10;
if soal4<> 'dede yusuf' then
skor4:=skor+0;
readln;
end;
procedure pertanyaan5;
begin
writeln('pertanyaan kelima');
writeln;
write('siapa penemu lampu bohlam:'); read(soal5); readln;
if soal5='thomas alfa edison' then
writeln('anda betul')
else
writeln('anda salah');
if soal5='thomas alfa edison' then
skor5:=skor+10;
if soal5<> 'thomas alfa edison' then
skor5:=skor+0;
readln;
end;
procedure pertanyaan6;
begin
writeln('pertanyaan keenam');
writeln;
write('10*9*8*7*6*5*0*3*2*1:'); read(soal6); readln;
if soal6='0' then
writeln('anda betul')
else
writeln('anda salah');
if soal6='0' then
skor6:=skor+10;
if soal6<> '0' then
skor6:=skor+0;
readln;
end;
procedure pertanyaan7;
begin
writeln('pertanyaan ketujuh');
writeln;
write('apa nama latin padi:'); read(soal7); readln;
if soal7='oryzae satyva' then
writeln('anda betul')
else
writeln('anda salah');
if soal7='oryzae satyva' then
skor7:=skor+10;
if soal7<> 'oryzae satyva' then
skor7:=skor+0;
readln;
end;
procedure pertanyaan8;
begin
writeln('pertanyaan kedelapan');
writeln;
write('bapak nya bapak kamu adalah:'); read(soal8); readln;
if soal8='kakek' then
writeln('betul')
else
writeln('anda salah');
if soal8='kakek' then
skor8:=skor+10;
if soal8<> 'kakek' then
skor8:=skor+0;
readln;
end;
procedure pertanyaan9;
begin
writeln('pertanyaan kesembilan');
writeln;
write('utut ardianto adalah atlet:'); read(soal9); readln;
if soal9='catur' then
writeln('anda betul')
else
writeln('anda salah');
if soal9='catur' then
skor9:=skor+10;
if soal9<> 'catur' then
skor9:=skor+0;
readln;
end;
procedure pertanyaan10;
begin
writeln('pertanyaan kesepuluh');
writeln;
write('siapakah vokali band slank:'); read(soal10); readln;
if soal10='kaka' then
writeln('anda betul')
else
writeln('anda salah');
if soal10='kaka' then
skor10:=skor+10;
if soal10<> 'kaka' then
skor10:=skor+0;
readln;
end;
begin
textbackground(5);
clrscr;
writeln('program kuis');
readln;
write('masukan nama:'); read(nama);
writeln;
readln;
writeln('halo ',nama,', tekan enter');
readln;
clrscr;
pertanyaan1;
clrscr;
pertanyaan2;
clrscr;
pertanyaan3;
clrscr;
pertanyaan4;
clrscr;
pertanyaan5;
clrscr;
pertanyaan6;
clrscr;
pertanyaan7;
clrscr;
pertanyaan8;
clrscr;
pertanyaan9;
clrscr;
pertanyaan10;
clrscr;
skor_to:=skor1+skor2+skor3+skor4+skor5+skor6+skor7+skor8+skor9+skor10;
writeln('skor ',nama,' adalah ',skor_to);
readln;
if skor_to>70 then writeln('kamu hebat')
else
writeln('kamu bodoh');
readln;
end.

Related Posts by Categories



2 komentar:

  1. de ahmad makasih source kodenya, semoga impiannya tercapai yaah,

    semoga sukses;

    BalasHapus
  2. Wih, keren... Langsung work bro thanks ya...

    BalasHapus

silahkan kalau mau komentar,kritik,saran masukan dan pertanyaan bebas