31.10.06
27.10.06
1 #include
2 #include
3 #define FILENAME "fibs1.txt"
4
5 int fibo(int n);
6 int isfibo(int x);
7 int rand_int2(int a, int b);
8
9 int main (void)
10 {
11 /* Variable declaration */
12 int a,b,k,z,no_sample,count,fib_d,seed;
13 FILE*fibs;
14
15 /* Open file */
16 fibs = fopen(FILENAME, "r");
17 if (fibs==NULL)
18 printf("Error reading input file.\n");
19 else
20 {
21 while((fscanf(fibs,"%i %i %i %i",&seed,&a,&b,&no_sample))==1);
22 {
23 srand(seed);
24 for(k=1; k<=b-a+1; k++)
25 {
26 z=rand_int2(a,b);
27 if (isfibo(z)==1)
28 count++;
29 }
30 /* Compute density of Fibs */
31 fib_d= count*100/no_sample;
32
33 /* Print values. */
34 printf("Seed: %d, lower: %d, upper: %d\n",seed,a,b);
35 printf("sampled fibs: %d, samples: %d, "
36 "percentage: %d%%\n",count,no_sample,fib_d);
37 printf("num fibs: %d, total: %d, percentage: "
38 "%d%%\n",count,no_sample,fib_d);
39 }
40
41 /* Close file */
42 fclose(fibs);
43 }
44
45 /* Exit program */
46 return 0;
47
48 }
49 /*---------------------------------------------------*/
50 /* This function generates a random integer */
51 /* between specified limits a and b (a
52 int rand_int2(int a, int b)
53 {
54 if (RAND_MAX == 32767)
55 return (rand()<<15^rand())%(b-a+1)>
56 else
57 return rand()%(b-a+1) + a;
58 }
59 /*---------------------------------------------------*/
60 /* This function generate the nth fibonacci number */
61 /* of the fibonacci series. */
62
63 int fibo(int n)
64 {
65 if (n<2)>
66 return 1;
67 else
68 return fibo(n-1)+fibo(n-2);
69 }
70 /*---------------------------------------------------*/
71 /* this input checks if the input is a fibonacci */
72 /* number. */
73
74 int isfibo(int x)
75 {
76 int h;
77 for(h=1; h<=x; h++)
78 if (x==fibo(h))
79 return 1;
80 return 0;
81 }
the first lab assignment that i submitted.. didn't submit the first 2.. stupid program took me at least 3 hr.. and the practical test in two weeks time only gives us 1 hr 45. .. heck.
2 #include
3 #define FILENAME "fibs1.txt"
4
5 int fibo(int n);
6 int isfibo(int x);
7 int rand_int2(int a, int b);
8
9 int main (void)
10 {
11 /* Variable declaration */
12 int a,b,k,z,no_sample,count,fib_d,seed;
13 FILE*fibs;
14
15 /* Open file */
16 fibs = fopen(FILENAME, "r");
17 if (fibs==NULL)
18 printf("Error reading input file.\n");
19 else
20 {
21 while((fscanf(fibs,"%i %i %i %i",&seed,&a,&b,&no_sample))==1);
22 {
23 srand(seed);
24 for(k=1; k<=b-a+1; k++)
25 {
26 z=rand_int2(a,b);
27 if (isfibo(z)==1)
28 count++;
29 }
30 /* Compute density of Fibs */
31 fib_d= count*100/no_sample;
32
33 /* Print values. */
34 printf("Seed: %d, lower: %d, upper: %d\n",seed,a,b);
35 printf("sampled fibs: %d, samples: %d, "
36 "percentage: %d%%\n",count,no_sample,fib_d);
37 printf("num fibs: %d, total: %d, percentage: "
38 "%d%%\n",count,no_sample,fib_d);
39 }
40
41 /* Close file */
42 fclose(fibs);
43 }
44
45 /* Exit program */
46 return 0;
47
48 }
49 /*---------------------------------------------------*/
50 /* This function generates a random integer */
51 /* between specified limits a and b (a
52 int rand_int2(int a, int b)
53 {
54 if (RAND_MAX == 32767)
55 return (rand()<<15^rand())%(b-a+1)>
56 else
57 return rand()%(b-a+1) + a;
58 }
59 /*---------------------------------------------------*/
60 /* This function generate the nth fibonacci number */
61 /* of the fibonacci series. */
62
63 int fibo(int n)
64 {
65 if (n<2)>
66 return 1;
67 else
68 return fibo(n-1)+fibo(n-2);
69 }
70 /*---------------------------------------------------*/
71 /* this input checks if the input is a fibonacci */
72 /* number. */
73
74 int isfibo(int x)
75 {
76 int h;
77 for(h=1; h<=x; h++)
78 if (x==fibo(h))
79 return 1;
80 return 0;
81 }
the first lab assignment that i submitted.. didn't submit the first 2.. stupid program took me at least 3 hr.. and the practical test in two weeks time only gives us 1 hr 45. .. heck.
26.10.06
25.10.06
24.10.06
a simple prayer
never heard
a silent worry
never told
a quiet concern
never shown
there she lay, bedridden, silently asleep ... or maybe she was awake but too weak to say anything. i don't know. i only got a glimpse. And in that brief moment, i was so overwhelmed by fear and ladened with guilt.. i haven't been a filial grandson. it was only this morning did i know about grandma's operation. And the more pa told me about the pain that grandma went through, the more guilty i felt. guilty for not doing enough.... guilty for being helpless...

"Urban legend has it that if you post your grudge on a mysterious web page at the stroke of midnight, Enma Ai - a young, pale girl known as the "Girl From Hell" - will come offering you a straw doll with a string around its neck.
"Untie the string, and she will drag your tormentor down to Hell. But only if you first agree to her terms: that you too shall spend eternity in Hell after you die, and she gives you a little preview first.. "

haha, sounds so cool... and it's coming to Animax tonite at 1134pm (and tt's the figure u get if you invert the word, "hell") No idea, somehow i've got a sudden craving for spookly films.
23.10.06
freakin' troublesome and super user-unfriendly..
yesterday, i tried to access the student companion site that requires a 17-character code cos the later mle chapters are not found in the textbook itself... the registration part was really troublesome for they ask all sorts of question.. after that i was notified that i was reply an authentication email within 24 hrs, an email which was nowhere to be found... 24 hrs later, more or less, no email, no nothing. i decided to seek help through the technical support page, which requires me create another account, the technical support account, another tedious round of registration... after that was done, diaoz, they threw one whole list of 256 questions, and expects me to find the relevent one... lazy as usual, i choose the most general,"Ask a Question." tab... then they prompt you for the problem you enounter.. the title of the book, the website, the login user id password, the resource type etc etc... the most frustrating thing was all the additional fields that keep popping out out of nowhere.. for instant you chose "student companion site" under Category, then another field appears to ask for the sub category, and it goes on and on... you tell them that you're from singapore, they had to know which school you're in & for some reason, our address as well... for goodness sake i just wanted to ASK A FREAKIN QUESTION... and you prompt me so many bloodly times, b4 i could even do that.. i was so pissed i swear i almost swept my monitor clear off my table. after submitting, they presented another list of questions hoping that one of them would be relevant to my mine..anyway, the site's catered to a couple of other textbooks and so many other online features, i didnt even know which category i was in...
then, a 12-digit ticket number.
yesterday, i tried to access the student companion site that requires a 17-character code cos the later mle chapters are not found in the textbook itself... the registration part was really troublesome for they ask all sorts of question.. after that i was notified that i was reply an authentication email within 24 hrs, an email which was nowhere to be found... 24 hrs later, more or less, no email, no nothing. i decided to seek help through the technical support page, which requires me create another account, the technical support account, another tedious round of registration... after that was done, diaoz, they threw one whole list of 256 questions, and expects me to find the relevent one... lazy as usual, i choose the most general,"Ask a Question." tab... then they prompt you for the problem you enounter.. the title of the book, the website, the login user id password, the resource type etc etc... the most frustrating thing was all the additional fields that keep popping out out of nowhere.. for instant you chose "student companion site" under Category, then another field appears to ask for the sub category, and it goes on and on... you tell them that you're from singapore, they had to know which school you're in & for some reason, our address as well... for goodness sake i just wanted to ASK A FREAKIN QUESTION... and you prompt me so many bloodly times, b4 i could even do that.. i was so pissed i swear i almost swept my monitor clear off my table. after submitting, they presented another list of questions hoping that one of them would be relevant to my mine..anyway, the site's catered to a couple of other textbooks and so many other online features, i didnt even know which category i was in...
then, a 12-digit ticket number.
21.10.06
blading + chilled Ribena = shiok.
blading + chilled Ribena + seafood dinner = heaven.
Trips to the Esplanade always include a brief stop at the underground linkway where there are rollerbladers weaving between the pillars, and the Capoera and hip hop-dancers.. people gliding on wheels and those dancing with their bicycles what-have-you... in my GP classes back in jc, we called them The Subculture... little did i expect myself to be part of the group today cos today, blading session is not at hazey East Coast, it's down at Esplanade Underground! *Woohoo* it felt alot different cos it felt like skating on ice... and alot more fresh air..
had dinner with my relatives at Jerry's BBQ & Grill... nice combination of food and ambience.. they've got all the really antique stuf on display... including model planes from WWII, doesn't require you to know much about history to appreciate this.. entirely fu4 gu3. nice.
blading + chilled Ribena + seafood dinner = heaven.
Trips to the Esplanade always include a brief stop at the underground linkway where there are rollerbladers weaving between the pillars, and the Capoera and hip hop-dancers.. people gliding on wheels and those dancing with their bicycles what-have-you... in my GP classes back in jc, we called them The Subculture... little did i expect myself to be part of the group today cos today, blading session is not at hazey East Coast, it's down at Esplanade Underground! *Woohoo* it felt alot different cos it felt like skating on ice... and alot more fresh air..
had dinner with my relatives at Jerry's BBQ & Grill... nice combination of food and ambience.. they've got all the really antique stuf on display... including model planes from WWII, doesn't require you to know much about history to appreciate this.. entirely fu4 gu3. nice.

19.10.06
Genuine emotions...do i still have acces to them? Nowadays, i realise that i smile when i wasn't really happy, i try to cry when i wasn't really sad.. Sometimes being too blinded by hatred, i try to recall only the times when the other party upsets me,thereby forgeting entirely the good in them..
Maybi all these was just an attempt to ensure that nostalgia didn't engulf me when parting was inevitable... Sometimes i do the same when i feel that i wasn't strong enough, when the strength to fight back eludes me...recently, i was described by a friend as a cold person.. guess it's only recently.. i find a false sense of strength just by being nonchalant bout everything else..but within, i guess im still one who is easily affected emotionally..
the past few minutes on the electone, somehow, invoked some memories.. times when i really cry without having to force myself... times i laugh subconsciously about just by thinking bout it... times when im really afraid and defeated... times when im truely touched... everything that is missing in my life now.
haha, paiseh, verbal diarrhoea... crap too much le... currently listening to Forbidden City songs.. reminds me of another heartwarming musical... ha, stil rmb the lyrics...
css pple, stil remember?
Maybi all these was just an attempt to ensure that nostalgia didn't engulf me when parting was inevitable... Sometimes i do the same when i feel that i wasn't strong enough, when the strength to fight back eludes me...recently, i was described by a friend as a cold person.. guess it's only recently.. i find a false sense of strength just by being nonchalant bout everything else..but within, i guess im still one who is easily affected emotionally..
the past few minutes on the electone, somehow, invoked some memories.. times when i really cry without having to force myself... times i laugh subconsciously about just by thinking bout it... times when im really afraid and defeated... times when im truely touched... everything that is missing in my life now.
haha, paiseh, verbal diarrhoea... crap too much le... currently listening to Forbidden City songs.. reminds me of another heartwarming musical... ha, stil rmb the lyrics...
let there be new light.. let darkness slip away...
let the dew drops sparkle ... let the rose quench their early thirst...
let there be butterflies... adding colours to the sky...
let there be fragrance of roses...
refreshing, refreshing my soul..
let there be new light.. ah~ha~
let the morning by gay and bright...
css pple, stil remember?
17.10.06
Once, she flung UHU glue at my eyes... Then there was another time, she snatched my swimming trucks and made me chase her around for it...the first time i was punished in front of the entire school... Today Boyan asked if i still remember Yanghui from Nanyang pri... How..how could i ever forget the girl who tormented me and made my life a living hell...
"Yup, she's not dead yet."...
Learnt that she currently dwells in NTU and is trying to organise a gathering. Grudges aside, i'm rather curious to know how's she get on with life. Sometimes i realise that i simply lock my childhood memories away.. Can't remember the last time i mentioned bout it...
"Yup, she's not dead yet."...
Learnt that she currently dwells in NTU and is trying to organise a gathering. Grudges aside, i'm rather curious to know how's she get on with life. Sometimes i realise that i simply lock my childhood memories away.. Can't remember the last time i mentioned bout it...
16.10.06
15.10.06
back to the beach... back on wheels ... back on blades...
watched world trade centre with og friends at vivo city which coincidentally happens to be situated at where our previous world trade centre used to stand. Pity there wasn't much chance to check out the entire place, looks like a pretty good hang-out place to me.. The movie was a letdown though, but, the climax aside, there are certain scenes which gripped me...
..when the car was held at the junction to a seemingly deserted street, and the traffic lights seemed determined to stay red...
...when John's wife, at the verge of breaking down, cried,"I can't even remember what i last said to him."...
..when Will's wife dashed out into the streets and for that brief moment, was unsure where she was heading...
... the quiet few minutes after Will was rescued, leaving John standed in the rubble...
...when one officer from the rescue team said, "There are thousands of people in there. Where the hell did they go?"...
haha, maybi you guys might not agree with me, but i felt that these little moments played with our emotions abit..
watched world trade centre with og friends at vivo city which coincidentally happens to be situated at where our previous world trade centre used to stand. Pity there wasn't much chance to check out the entire place, looks like a pretty good hang-out place to me.. The movie was a letdown though, but, the climax aside, there are certain scenes which gripped me...
..when the car was held at the junction to a seemingly deserted street, and the traffic lights seemed determined to stay red...
...when John's wife, at the verge of breaking down, cried,"I can't even remember what i last said to him."...
..when Will's wife dashed out into the streets and for that brief moment, was unsure where she was heading...
... the quiet few minutes after Will was rescued, leaving John standed in the rubble...
...when one officer from the rescue team said, "There are thousands of people in there. Where the hell did they go?"...
haha, maybi you guys might not agree with me, but i felt that these little moments played with our emotions abit..
~~~
9/11 showed us what Man is capable of... the evil, yes...
..but also the good that many of us forgot still existed..
14.10.06
13.10.06
妈的, some bastard in nus stole my mp3. there goes my collections of songs.. before that i was still thinking of getting it repaired this coming sat.. i don't see the need to go down to jp anymore..
didn't really believe in fri the 13th until today.. unluck for me, lucky for some freakin bastard..
pardon me for e vulgarites**
12.10.06
when the throbbing headache deteriorated into a dizzy spell and occassional urges to puke, it probably was a sign that my brain was working harder than it's capable of... i don't know.. before every paper.. i'd spend a moment listening to a couple of songs from my mp3 to soothe myself.. one of them was "When you believe".. yes, it's the theme song to Prince of Egypt.. i know it sounds kind of lame but guess i was seeking some sort of a blind faith which i could seek comfort in..i remembered that Caiting once lamented that she's so buzy with all the projects and assignment, she could hardly find time for herself.. though im still in my first sem, im starting to feel the same way for myself.. but i wasn't really tired, im just afraid of losing and failing, and for some reason, certain things just don't happen the way i expect them to...
one and half hours more.... continue mugging.
one and half hours more.... continue mugging.
10.10.06
9.10.06
8.10.06
7.10.06
mm... instead of an open book test, maybi they should have an open lap-top test.. hai, didn't realli know how i fared for the programming test this morn... too many pit holes.. didn't really know how many i had fallen into.. and, how in the world would i know the name of Bill Gates's wife? Are they even allowed to ask that in the test?... guess i'd get better grades if there's a computation error when they calculate my marks... *shucks* now im talking like a geek. Couldn't perform at the concert because of my Physics test tonight.. but still got to meet up with some of my army friends.. that was enough for a compensation i guess.. ha, wished we could hang ard much longer... like what toms said, to celebrate the completion of our four-fifth of our mid term package,.. Last paper's four days later, time for a breather... .... hai, today's ma's bday, guess it went unnoticed again..
6.10.06
5.10.06
4.10.06
Subscribe to:
Posts (Atom)









realli miss my hamz...








