Wednesday, March 10, 2010

array of strings

Here is a interesting array of strings function, the output of the function is result of str[0] + str[1]:

int main(void)
{
char str[][40] = { "AAA",
"BBBBBBBB"
};
int strLength[] = {0, 0};
int i;
for(i = 0 ; i<2 ; i++){
while (str[i][strLength[i]])
strLength[i]++;
}

if(sizeof str[0] < strLength[0] + strLength[1] + 1){
printf("\nNo enough space");
}else{
strLength[1] = 0;
while((str[0][strLength[0]++] = str[1][strLength[1]++]));
printf("\n%s\n", str[0]);
}
return 0;
}

Friday, January 29, 2010

OOP WEEK 3 Challenge

OOP WEEK 3 Challenge
void bio_putint(int val){
char p[100];
int temp,i=0;
while (val/10 > 0){
temp = val ;
p[i++] = '0' + temp % ((val=val/10)*10);
}
p[i++] = '0'+ val;
p[i] ='\0';
for(i = i-1; i>=0; i--)
bio_putch(p[i]);

}

Sunday, January 24, 2010

about svn

to use svn, there are simple steps as follow:

1 check out repository, use following command(just at first time):
svn co URL(for example:svn://zenit.senecac.on.ca/oop344)

2 update the repository, use the command:
svn update

3 To add files , use the command:
svn add FILENAMES

4 To submit your files modified, use the command:
svn commit

More detail about SVN, refer to SVM-BOOK.pdf

Friday, January 15, 2010

First Post

This is a test post!