Sunday, November 28, 2010

Dealing with link list in C

Link lit in c is a challenging lesson but I am grateful that I learned it.
it was such a practical lesson. Though I still prefer to program arrays, I still find dynamic memory allocation handy. I have learned techniques that are handy.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_C 200
typedef char string7[8];
typedef char string25[26];

typedef struct
{
string25 first, last;
char mid;
}nameType;

struct courseTag
{
string7 courseCode;
float units, grade;
nameType facultyName;
};
typedef struct courseTag arrCourses[MAX_C];

struct studentTag
{
nameType name;
arrCourses course;
int numCourse;
float CGPA;
struct studentTag *pLink;
};
typedef struct studentTag *ptrStudent; /*this alias can be used to avoid confusion in using an asterisk*/
/*you can not use the same typedef call like nameType in studentTag, because you will be calling the alias that hasn't been declared yet*/

/*This function allows to insert node in alphabetical order*/
void insert(ptrStudent *pFirst){/*Alphabtical insertion*/
char tmp;
ptrStudent pNew,pRun,pLast;
pNew=malloc(sizeof(struct studentTag));
printf("Enter first name: ");
fgets(pNew->name.first,sizeof(string25),stdin);
printf("Enter miidle intial: ");
scanf("%c%c",&pNew->name.mid,&tmp);
printf("Enter last name: ");
fgets(pNew->name.last,sizeof(string25),stdin);
pNew->pLink=NULL;
if(*pFirst==NULL)
*pFirst=pNew;
else
if(strcmp((*pFirst)->name.last,pNew->name.last)>0)
{
pNew->pLink=*pFirst;
*pFirst=pNew;
}
else {
pRun=*pFirst;
while(pRun!=NULL&&strcmp(pRun->name.last,pNew->name.last)<0)
{
pLast=pRun;
pRun=pRun->pLink;
}
if(pRun)
pNew->pLink=pRun;
pLast->pLink=pNew;

}

}

Wednesday, November 10, 2010

Team trouble

Currently, we are suppose to be working on are term paper and presentation of it.
Somehow it seems that it can't be done since we have not even researched and do other important task for it. Unfortunately my schedule conflicts and their schedules are different from mine.

We need to be organized. I need a good grade in the report and presentation. I hope this won't end bad. My studies are important. My subjects are conflicting with me. I hope I get it together and so can the others

Friday, November 5, 2010

I realized form C programming

I have been studying c programming for the past months and I am in a good pace but I wish I can learn faster. It takes a month for me to learn the c language. It takes even longer to improve it. My skills improve with practice practice practice. I have no plans on stopping because I like doing it. I have passion for programming which is why I pursue learning it. I plan to learn other languages now.#

I am interested in object oriented programming. I saw this site http://www.programmersheaven.com/2/VB-NET-School and I learned Vb at a nice pace. I still want to learn more though. I plan to learn windows forms. I also want to learn c++

The other platform is java. I learned some basic java (luckily it is similar to c). Net beans helped a lot. I plan to learn more about it some other time.

I realized that it is effective to learn one platform at a time to save me from more confusion. I have confirmed that having passion on subjects you're passionate about can really makes effective learning.

I wish what I learn can help me in the future.