alhamdulillah,
pada 18/7/2013
jam 2:06 am
ana berjaya juga menyiapkan coding yang menjadi,
untuk program Roman NUmber Converter niii,
ini tentera ROMAN |
huh,
agak sukar pada mulanya,
ana jadi tak khusyuk mase terawih,
sebab asyik terpikiaq pasai mende ni,
runsing sgt bile ana x dapat buat,
balik silat,
ana dah siapkan fizikal and mental utk siapkan jugak mende ni,
ana x kesah ape da,
MESTI MENJADI JUGAK
ni prinsip utk malam ni,
ana pun padam sume koding sebelum ni,
ana tulis koding baru,
and akhirnya ana berjaya belajar mende baruu,,
rupanyaa,
kalau kite gune multiple choice CASE...OF
kite kene letak END; pada hujung nyerr,
hahahaha,
mane la ana taw selameni,
then bile gune FOR...(condition)...THEN,
kalau ade >1 statement, letak BEGIN dan END
and pastikan END tu tiada simbol,
kosong shje,
hahaha
okay ana sebenarnye ade jumpe jawapan da mase kat lab tu,
tapi ana x suka la nak copy paste jawapan orang,
so, ni lha jawapan nyer,
tapi ana punye jawapan len sket, and ana rase x sekompleks jawapan budak ni
tengok ehh
***************************************
CODING BUDAK NI
program roman;
var
num, //hold the user input
ones, //holds ones, tens, hundreds and thousands
tens, // of the number after separate the digits
hundreds,
thousands:integer;
begin
write ('Please enter a number [1..3999]>');
readln (num); //separating the digits
if (num>=1) and (num<4000) then //checking valid inputs
begin
write ('It is written in Roman as > ');
if num>=1000 then
begin
thousands:=num div 1000; // separating thousands
case thousands of // display thousands in ROMAN
1:write ('m');
2:write ('mm');
3:write ('mmm');
end;
num:=num mod 1000; //take the remainder for hundreds
end;
if num>=100 then
begin
hundreds:=num div 100;
case hundreds of
1:write ('c');
2:write ('cc');
3:write ('ccc');
4:write ('cd');
5:write ('d');
6:write ('dc');
7:write ('dcc');
8:write ('dccc');
9:write ('cm');
end;
num:=num mod 100;
end;
if num>=10 then
begin
tens:=num div 10;
case tens of
1:write ('x');
2:write ('xx');
3:write ('xxx');
4:write ('xl');
5:write ('l');
6:write ('lx');
7:write ('lxx');
8:write ('lxxx');
9:write ('xc');
end;
num:=num mod 10;
end;
if num>=0 then
begin
ones:=num;
case ones of
1:write ('i');
2:write ('ii');
3:write ('iii');
4:write ('iv');
5:write ('v');
6:write ('vi');
7:write ('vii');
8:write ('viii');
9:write ('ix');
end;
end;
end
else
writeln ('Sorry, we do not accept the number, please try again.');
readln();
end.
**********************************************************************
CODING ANA
program
romanconverter;
var
num,ribu,ratus,puluh,sa:integer;
begin
writeln('insert number between 1..3999');
readln(num) ;
if num<4000 then
begin
write('number in roman is >>> ');
ribu:=num div 1000;
case ribu of
1:write('m');
2:write('mm');
3:write('mmm');
0:write('');
end;
ratus:=num mod 1000 div 100;
case ratus of
1:write('c');
2:write('cc');
3:write('ccc');
4:write('cd');
5:write('d');
6:write('dc');
7:write('dcc');
8:write('dcc');
9:write('cm');
0:write('');
end;
puluh:=num mod 1000 mod 100 div 10 ;
case puluh of
1:write('x');
2:write('xx');
3:write('xxx');
4:write('xl');
5:write('l');
6:write('lx');
7:write('lxx');
8:write('lxxx');
9:write('xc');
0:write('');
end;
sa:=num mod 1000 mod 100 mod 10 ;
case sa of
1:write('i');
2:write('ii');
3:write('iii');
4:write('iv');
5:write('v');
6:write('vi');
7:write('vii');
8:write('viii');
9:write('ix');
0:write('');
end;
end
else
writeln('not in range');
readln;
end.
*******************************************************************
so, kalau anta boleh tengok perbezaan nye,
maka syabas laa,
anta semua taw tak number roman ni camner?
number roman ni yg
anta bace la sendirik, ana malas nak terangkan,
hahahaha
okay?
haa bace la sendiri,
lastly nak ucap selamat berpuase untuk hari ke-8,
dah seminggu dah kan
banyakkan beribadah kepada Allah,
moga Allah melipat ganda kan ganjaran kepada kita,
assalamualaikum.
~end of today: marilah belajar bahasa arab, boleh speaking arab ngn lecturer!~
No comments:
Post a Comment