Saturday, November 28, 2009

assignment2

I don;t know wheather class IO_Vedit can work properly,the following is the method edit():

int IO_Vedit::edit()
{
char* p =0;
int key =0;
int keep =1;

if (!_owner )
key = IO_Edit::edit();
else if (_Help)
{
(*_Help)(SetMessage,*_owner);
while (keep)
{
key = IO_Edit::edit();
if (_Validate)
{
*p = (char)key;
if ((*_Validate)(p,*_owner))
keep =0;
}
if (!(key == UP_KEY || key == DOWN_KEY || key == TAB_KEY || key == ENTER_KEY))
keep = 0;
}
if (_Help)
(*_Help)(ClearMessage,*_owner);
}
return key;
}

Sunday, September 20, 2009

oop344

Challenge: write this function without using any library functions; void GetInt(char *strint, int val);
this function gets an integer value and converts it to a string ("strint")

GetInt(char *strint, int val){
char p[100];
int a=0,c=0,i=0,j=0;
a=val;
while (a/10 > 0){
c = a ;
p[i++] = '0' + c % ((a=a/10)*10);
}
p[i++] = '0'+ a;
p[i] ='\0';
while (i >0 )
strint[j++] = p[--i];
strint[j]='\0';
printf("%s\n",strint);
}


Monday, September 14, 2009

OOP344

Today I learn press ctrl + F5 in Visual Studio 2008 to start without debugging program.