2008-01-20

Snow

This Year's First Snow , Today .




2008-01-18

Monkey And Peach

On The Beach Has Pile Of Peach , Five Monkeys Divide. The First Monkey Divides Into Equally This Pile Of Peach Five , But More Than A Peach ,This Monkey Throws Away Much One Into The Sea ,Having Taken One Portion Of Five Peach Away .The Second Monkey Equally Divides Into The Peach Five Which Is Left Over , Also More Than A Peach , It Has Thrown Away Much One Into The Sea , Took Away One Portion ,Similarly . The Third , The Fourth , The Fifth Monkey Are All Done By Such . Question , How Many Peach On The Beach Most Little Has In Originally ?

main( )
{
 int i,m,j,k,count;
 for(i=4;i<10000;i+=4)
 {
  count=0;
  m=i;
  for(k=0;k<5;k++)
   {
     j=i/4*5+1;
     i=j;
     if(j%4==0)
     count++;
     else
     break;
   }
  i=m;
  if(count==4)
   {
    printf("%d\n",count);
     break;
   }
 }
}

2008-01-13

Distance

Sometimes The Walked Is Nearer , But The Distance Is Farther ... ...

2008-01-09

Interesting Decode

main(_){ for ( --_ ; putchar( _++["J!Mpwf!Zpv\1"] - 1 ) ; ) ; }

Program : Prints "I Love You"
//Not Including The Quotation Marks
//File Name : xx.c
//Programming Language : C
//Author : Unknown
//This Program Simply Prints "I Love You" And Exits.

This Lets Me Remember A Story Of About Mathematics : Mathematician Descartes In Writes Letter For Sweden Princess Christina , Has Only A Formula " R=A(1-Sinθ) " .
He-He , With Polar Coordinate System A Beautiful Heart Shape Line .
It's A Good Idea .

2008-01-06

About Strcpy

Realizes Strcpy () Function , Didn't Use C++ Library , Compile With Self .

char * strcpy(char * strdesc,char * strsrc)
{
char *p ;
if(strsrc == NULL)
exit ;
if(strdesc == strsrc)
return strdesc ;
p = strdesc ;
while( *strsrc == '\0')
*strdesc++ = *strsrc++ ;
return p ;
}

In High Quality C / C++ Programming Guide
LinRui's Answer:

char *strcpy(char *strDest, const char *strSrc);
{
assert((strDest!=NULL) && (strSrc !=NULL)); // 2 Points
char *address = strDest; // 2 Points
while( (*strDest++ = * strSrc++) != ‘\0’ ) // 2 Points
NULL ;
return address ; // 2 Points
}

SomeOne

Also About Friend's SMS Message.

I Love You Not Because Of Who You Are . But Because Of Who I Am When I Am With You . No Man Or Women Is Worth Your Tears , And The One Who Is , Will Not Make You Cry . The Worst Way To Miss Someone Is To Be Sitting Right Beside Them Knowing You Can Not Have Them . Never Frown , Ever When You Are Sad , Because You Never Know Who Is Falling In Love With Your Smile .

2007-12-30

SomeBody

Today , A Friend SMS A Message To Me , I Feel Like A Tongue Twister .

To The World You May Be One Person,But To One Person You May Be The World. If You Not Have The Person.Do Not Try To Hard.The Best Things Come When You Least Expect Them To. Maybe God Wants Us To Meet A Few Wrong People The Right One.So That When We Finally Meet The Person,Not miss. But Do Not Waste Your Time On A Man Or Woman,Who Is Not Willing To Waste Their On You.

About SSCANF

Keywords: %[a-z] SSCANF Delimit
Before Long Time Ago, I Thought C Not Itself Split String Function,Afterward I Have Discovered SSCANF; Since Continuously, I Thought That SSCANF Can Only Limit The String Of Character By The Blank Space, Now I Found That I Was Wrong.

SSCANF Is When A Movement Function, The Primary Form Is Very Simple:int sscanf(const char *buffer,const char *format [,argument ] ... );
Its Formidable Function Manifests To Format In The Support .

#include < iostream >
#include "stdio.h"
#include "string.h"
using namespace std;
int main( )
{
char ip[20];
char *p;
int port;
char * strip="192.0.168.1:8080";
sscanf(strip.c_str(),"%s:%d",&ip[0],&port );
p = strstr( ip, ":"); //Would Not Search ":" Here ?
*p = 0;
cout << ip << endl;
cout << port << endl;
// printf("%s\n",ip);
}

But In This Example,WHy Must Find ":" In String ? Otherwise Cannot Split String Or Output Error .

2007-12-26

The Three Little Pigs

Posted by Picasa
If Saw Du Zhengsheng On The One Side Digs The Nose Excrement ,One Side Mouth-watering ,One Side Dozing Off,May Said To Him, You Really Look Like The `The Three Little Pigs' It's Eldest Pig Second Pig Third Pig, This Just Utilizes The Idiom.