Fly Away
Home About Stuffs Twitter Follow Dash

owner


" I just wanna fly away with my friend from all the bitch for a while "

stories


tagboard


Instagram



Follow @nadixxi

Credits

© Template design by Adila. thanks for Base code by Atiqah.



Fundamental of Programming 1
Wednesday 28 August 2013 • 07:25 • 0 comments



Assalamualaikum w.b.t & annyeonghaseyo..

Ok. Aq dah lama senyap, right? HIATUS lah konon nya. Actually, esok aq final exam. Fundamental of Programming 1, English 2, Thinking Skills & Islamic Studies. Yup, 4 days. Pastu cuti yg ditunggu-2 , CUTI SEM wooo~

Ok, sorry. Back to the topic. Aq sebenarnya nak kasik contoh coding program yg aq dah buat. *lama kot nak buat benda ni**2 je*

1. 24-hours format change to 12-hours format.*Actually, classmate aq dah buat tp aq tak phm dia pnye program*

program may;

var i:integer;
    j:real;
    choice:char;
    decision:boolean;

begin
repeat
write('Please enter time in 24-hours format > ');
readln(i);
if i >= 1300 then
  begin
  j:=(i DIV 100) - 12.00;
  writeln('It is ',j:2:2,' p.m');
  end
else
 begin
 j:=i DIV 100;
 writeln('It is ',j:2:2,' a.m');
 end;

write('Do you want to try again [y/n] ');
readln(choice);
if (choice='n') then
 decision:=true
else decision:=false;

if (decision=true) then
  halt;
writeln;
until choice='n';
readln;
end.

Ni output nye.





2. Change font color.*Shorter that above*


program my;

uses crt;

var SColor: integer;

begin
repeat
writeln('Choose number to change your screen color');
writeln('1 . Blue');
writeln('2 . Green');
writeln('3 . Yellow');
writeln('4 . Red');
readln(SColor);
case SColor of
1 : Textcolor(blue);
2 : Textcolor(green);
3 : Textcolor(yellow);
4 : Textcolor(red);
end;
until SColor=4;
readln;
end.

Output :




Sorry, utk yg ke-2 tu aq still can't figure out why warna merah pnye tak keluar.
Sorry, i'm not an expert YET.



Doakan aq esok exam dpt jawab dgn tenang & tak menggigil [almaklumlah, dewan ber-AC] . Doakan utk sume paper ok :)






0 Comments:

Post a Comment


|