happy new year!!

5 01 2009

*walopun agak telat2 dikit ngga pa pa lah yaw*

Selamat Tahun Baru semuanyaaa

semoga di tahun yang baru ini, blog medium-brained ini bisa lebih sering dikunjungi hehe :P

*yaaah,namanya juga side blog, harus dinomor-duakan setelah blog utama :P *

okey,,,semoga di tahun 2009 ini, semua hal bisa jauh lebih baik dan lebih positif daripada tahun2 sebelumnya

bye all

mmmuah.wek.





It’s good to help others

13 04 2008

Well, though I feel pretty tired now, but in deep, I feel sooo happy now :)
As a medium-brained student from informatics engineering major, on my last year FINALLY I can do a-little-help for my friends doing her assignment and teach her a little about basic in programming -> though this is not my favourite subject ^_^

So, after 4 years I spend on college, what did I do that I haven’t make a positive thing for others, hehe,, especially with the title informatics-student??

That’s okay, at least, I still hope that the knowledge I shared to other people is a merit :)





it’s just dynamic arrays in Pascal

13 04 2008

Yep yep, and for my second post, I ‘only’ post something ‘light’ hehe. Well, kinda simple tips for programming in Pascal.

Actually, it’s been a very very long time since I use Pascal (about 3 years, as I remember). Well, it’s like that I prefer using Java :D

This afternoon, a friend of mine called me, and she asked me to teach her about simple Pascal programming all of sudden. Gosh, I really want to help her, but the thing is that I don’t really remember Pascal. And finally, I end up re-reading the Pascal book, looking for the compiler, and starting to code Pascal all over again, hehe. (Actuallty, it’s only for her assignment).

And in the middle of my-learning, I just thought about making a dynamic arrays in Pascal. We all know, that in Pascal, we must declare, which part is TYPE, which part is VAR, which part is BEGIN-END. The problem is, I want to declare an array, which size is determined by the user.

At first, I think about the VAR -part and the BEGIN-END-part, and I didn’t know, where should I put the declaration, where should I put the initialization. Wew,,confuse confuse confuse until I found a page here, http://www.freepascal.org/docs-html/ref/refsu14.html

Haha,,,everything is clear now. I found a solution to my simple problem. Here it is:


program ArrayDynamics;

TYPE
Point = record
X : integer;
Y : integer;
end;

TPoint = array of Point;

VAR
N : integer;
ArrayOfPoint : TPoint;
i : integer;

BEGIN

writeln('input the length : ');
readln (N);
SetLength(ArrayOfPoint, N);

for i := 1 to N do
begin
ArrayOfPoint[i].X := i;
ArrayOfPoint[i].Y := i+1;
end;

So, the solution is, make an Array type (on the TYPE-part), just declare the type of the array, is it array of integer, array of string, or array of a specific record, without the length.

Then, make an instance of the array on the VAR-part, for example, I made ArrayOfPoint as an instace of type TPoint.

And finally, one method-the key method, is SetLength (<the array>, <the lenght>). Use it to set the actual length of the array





square one

8 04 2008

Hello world!!

Well, this is actually what will happen if I have so many time without doing anything, and just waste it making a new blog, again and again hehe

Well, just wait what I’ll write down here.

Cheers