Thursday, November 16, 2006

CS1101c Practical Exam (PE)

One word to describe it ---> Cui aka 脆

But looking on the bright side, i knew the meaning of Palindrome.

For the benefit of those who dont, a palindrome is a sentence or word that means the same thing read forward or backwards irregardless of the punctuation.

For example,

Madam

A man, a plan, a canal, Panama!

Well now that you know what does that mean, let me talk a bit about my programming PE.
Well, we were given a source file that contains 25 strings (strings = sentences in C language) So we had to read in the file and print out the results exactly as what the question wanted. In the process, we also had to test whether the string was a palindrome and also to check the number of occurances of each word. Ie. "The" came out 5 times, "A" came out 8 times etc. So for the 1hr 45mins that I was in there, I spent effectively almost 45mins reading and thinking of the
algorithm and thus I spent 1hr fully on coding. So in the end I only managed to read in the file, printed out the strings properly by removing the unwanted '\n' character before the '\0' character. Although I had written a function to check whether the string was a palindrome it didnt work, but after attending the tutorial I realised I had seen that in a sample solution but I didnt remember it.
Oh well.

Now to shift to 5th gear since its reading week soon. Full throttle ahead!