Nothing to write
One of these days, I feel like I have nothing to write on my blog. Every day, things just happen to be quite the same. The lecturers just keep on teaching new chapters day by day. I take the bus to my campus from 9AM and back home at around 5PM. Whenever there's no more class for the day, I'll be hanging out in the Internet room and surf some web sites. For the whole week, my classmates and I will be busy to finish up our experiment reports and assignments before dateline.
Hmm.. now I understand why some university students don't have blogs. Even if they have one, it wouldn't be updated much often, like mine for example. Even if they update it often, the blog entries wouldn't be lengthy, or contain at least 3 paragraphs. Even though this is my personal blog, I don't write much about that small things that happen in my life. I don't blog about the ridiculous canteen food, the weird air conditioning system in my campus or my course mates' funny jokes. Besides, I take quite some time to write an entry as I need to make sure that my grammar is okay and my language is easily understandable. Generally, my weblog serves as a web platform for me to publish my own articles, opinions and experiments. That's all.
Before this, I use to spend some time on stuff other than my school homework. This is how I manage to learn HTML and CSS when I was in Form 4. Now, the situation is a little different. For the past few weeks, my mind is fully focused on a computer programming language called 'C'. I realised that my programming skills aren't so bad after all, though C seems to be quite harder than PHP. I have converted myself from a PHP beginner to a C beginner. Cool.
And don't worry, I do have few code examples to share, so here's one I like:
/* Calculate pi value */
#include <stdio.h>
#include <math.h>
int main(void)
{
unsigned long limit, i;
long double series = 0, pi;
double percentage, prev_percentage = -1;
printf("Enter the limit: ");
scanf("%d", &limit);
printf("Please wait... ");
for ( i=1 ; i<=limit ; i++)
{
series += 1.0/(pow(i,2.0));
/* calculate percentage */
percentage = (double) i/limit*100;
/* only print percentage when needed */
if ( (int) percentage > (int) prev_percentage )
printf("%3.f%%\b\b\b\b", percentage);
prev_percentage = percentage;
}
/* calculate pi */
pi = sqrt(6*series);
printf("Completed
pi = %lf
", pi);
return 0;
}
I've also coded a simple two-player number guessing game, for everyone's pleasure:
/* Two-player number guessing game */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MIN_NUM 0
#define MAX_NUM 100
int main(void)
{
int i, j, rand_num, guess_num, min_num, max_num;
char play;
do {
/* initialise min and max num */
min_num = MIN_NUM;
max_num = MAX_NUM;
/* generate random number */
srand(time(NULL));
rand_num = rand() % (max_num+1);
/* instructions */
printf("\tThis game requires two players.
");
printf("\tEach player have to guess a number between %d and %d.
", min_num, max_num);
printf("\tThe player who got it wins the game.
");
i = 0;
do {
/* switch both players */
if ( i % 2 == 1 )
j = 2; /* odd i */
else
j = 1; /* even i */
/* display which player */
printf("
");
if ( j == 2 ) printf("\t");
printf("Player %d
", j);
/* input guess number */
do {
if ( j == 2 ) printf("\t");
printf("Enter your guess: ");
scanf("%d", &guess_num);
if ( guess_num <= min_num || guess_num >= max_num )
{
if ( j == 2 ) printf("\t");
printf("\tYou should guess a number between %d and %d!
", min_num, max_num);
}
}
while( guess_num <= min_num || guess_num >= max_num );
/* re-assign min and max number */
if ( guess_num > rand_num )
max_num = guess_num;
else if ( guess_num < rand_num )
min_num = guess_num;
else
break;
/* display range of numbers available */
if ( j == 2 ) printf("\t");
printf("Range: %d - %d
", min_num, max_num);
i++;
}
while( guess_num > rand_num || guess_num < rand_num );
/* determine the winner */
printf("
");
if ( j == 2 ) printf("\t");
printf("Player %d is the winner! Yeah!!!
", j);
/* ask wanna play again? */
printf("Wanna play again (Y for yes) ? ");
fflush(stdin);
scanf("%c", &play);
/* clear the screen */
if ( play == 'Y' || play == 'y' )
system("cls");
}
while( play == 'Y' || play == 'y' );
return 0;
}
Please note that my codes are not perfect. Ignoring them is optional.
Due to this fact, it has been a long time I haven't focus on XHTML, CSS, PHP, icons design and theme design. I might not be able to participate in CSS Reboot Fall 2005 this time. As the release of Mozilla Firefox 1.5 is just around the corner, I really doubt if I could update my Phoenity theme in time. Sigh, so many work, yet so little time.
Labels: life, university
Previous Posts
About
cheeaun.com is the site of a Malaysian web developer and designer, Lim Chee Aun. He loves to babble about life, computers, design, internet and oranges. Read more...
Sponsors
cheeaun Done with my theme update for #fx35 (only windows part). Time to rest and sleep. # about 4 hours ago
Archives
- June 2004
- July 2004
- August 2004
- September 2004
- October 2004
- November 2004
- December 2004
- January 2005
- February 2005
- March 2005
- April 2005
- May 2005
- June 2005
- July 2005
- August 2005
- September 2005
- October 2005
- November 2005
- December 2005
- January 2006
- April 2006
- May 2006
- June 2006
- July 2006
- August 2006
- September 2006
- October 2006
- November 2006
- December 2006
- January 2007
- February 2007
- March 2007
- April 2007
- May 2007
- June 2007
- September 2007
- October 2007
- November 2007
- December 2007
- January 2008
- February 2008
- September 2008
People
- Aaron Spuler
- Alex Choong
- Ang Kew Leok
- Angeline Tan
- Arvid Axelsson
- Asa Dotzler
- Benjamin Leow
- Bernie Zimmermann
- B.K. Ong
- Chan Lilian
- Chan Ming Shern
- Cheah Chu Yeow
- Ching Yonghan
- Chris Neale
- Chris Pirillo
- Danny Foo
- Dave Shea
- David Tenser
- Elizabeth Chin
- Eric Meyer
- Heng Kee Seng
- Ian Hickson
- James Ooi
- Jeffrey Zeldman
- Jinny Wong
- Joe Clark
- Jon Hicks
- Kamal Fariz
- Kah Soon
- Ken Lynch
- Kenny Lee Jian Siong
- Kevin Gerich
- Khai Lee
- Khoo Kah Peng
- Kong Chung Hwa
- Kuhan Venugopal
- Kwan Will Sen
- Lars Kleinschmidt
- Liew Cheon Fong
- Lim Chze Hong
- Lucia Lai
- Lun
- Navin
- Neil Turner
- P.J.Kraaima
- Peter Tan
- Regin Larson
- Ryan Lim
- Saw Kee Wooi
- Scott Jarkoff
- Soo Chooi Leang
- Steven Garrity
- Tantek Çelik
- Teoh Hock Lye
- Tim Yang
Powered By
Believe it or not, this blog is powered by Blogger. Nothing else.