¡¾ÌâÄ¿4¡¿ÈçºÎ×Ô¼ºÊµÏÖCº¯Êýstrstr()
½âÌâ˼·£º Õâ¸öÍøÂçÉÏÒѾÓкܶà´ð°¸£¬ÕâÀï
ÁоÙÒ»¸ö¸´ÔÓ¶ÈΪ0(m*n)µÄÀý×Ó¡£ÊµÏÖµÄÔÀí
ºÜ¼òµ¥£¬Ë³Ðò±éÀúÒª²éÕÒµÄ×Ö·û´®£¬Èç¹ûûÓÐÕÒ
µ½£¬×Ö·û´®Ö¸ÕëÍùǰһ룬ÔÙÍùºó±È½ÏÒª²éÕÒµÄ
×Ö·û´®£¨Ä£Ê½´®£©£¬ÈçÏÂͼËùʾ£º
a b c d d d a d a c a b d a d d d a d c k
->
d a d a
char* strstr(const char* s1, const char* s2)
{
if(s1 == NULL || s2 == NULL)
return NULL;
while(*s1)
{
while(1)
{
int i = 0;
if(s2[i] == NULL)
return (char*)s1;
if(s2[i] != s1[i])
break;
i++;
}
s1++;
}
return NULL;
}
Ïà¹ØÎĵµ£º
¸´ÔÓµÄC\C++ÉùÃ÷£¬³£³öÏÖÔÚѧУµÄ¿¼¾í£¬ÃæÊÔÌâ»òÊÇÅ£ÈËÀÏÍâµÄ´úÂëÖС£
ÎÒÃÇÔÚʵ¼ÊµÄ¹¤×÷ÖУ¬Ó¦¸Ã¾¡¿ÉÄÜÉÙʹÓø´ÔÓµÄÉùÃ÷¡£¸´ÔÓµÄÉùÃ÷£¬»áÈÃÔĶÁÄú´úÂëµÄÈ˺ÜÊÇÓôÃÆ¡£
ËäÈ»²»Ê¹ÓÃÕâÖÖ¸´ÔÓµÄÉùÃ÷£¬µ«»¹ÊÇÓ¦¸Ã°Ñ½«ÈçºÎ½âÎöÕâÖÖ¸´ÔÓµÄÉùÃ÷µÄ·½·¨¼ÇÔÚÐÄÖС£
ËùÒÔ£¬ÎÒ°ÑÕâÖÖ·½·¨¼Ç¼ÏÂÀ´£¬ÒÔ±¸²»Ê±Ö®Ðè¡£
ÈëÃÅÌâ
1) Ò»¸öÕûÐ ......
Ö÷Ò³£º http://www.christian-heffner.de/
ÏÂÔØÁ´½Ó£º http://www.christian-heffner.de/index.php?page=download¡´=en
¼ò½é£º
»ùÓÚLCCµÄÒ»¿îC±àÒëÆ÷£¬Óбê×¼µÄIDE½çÃæ£¬ÀàËÆVCµÄ½çÃæ£¬µ±È»ºÍDEV-C++»¹ÓÐMingW32 studio½çÃæÒ²ºÜÏñ£¬¿ÉÒÔÓÃÓÚ´´½¨Ð¡Ò»µãµÄ»ùÓÚCµÄ¹¤³Ì¡£
IDE´úÂë±à¼½ ......
C²Ù×÷·ûµÄÓÅÏȼ¶ºÍ¹ØÁª¹æÔò
²Ù×÷·û
¹ØÁª¹æÔò
¹ØÁª²Ù×÷·û () [] -> .
´Ó×óµ½ÓÒ
Ò»Ôª²Ù×÷·û ! – ++ -- + - (type) * & sizeof
´ÓÓÒµ½×ó
³Ë·¨ºÍ³ý·¨ * / %
´Ó×óµ½ÓÒ
¼Ó·¨ºÍ¼õ·¨ + -
´Ó× ......
½ñÌì×°ºÃÁËmonodevelop£¬±¾À´ÊÇÏëÓÃÀ´C#µÄ£¬¼ûËûÒ²Ö§³ÖC/C++¿ª·¢£¬ÓÚÊÇÊÔÁËһϣ¬¸Ð¾õºÜ²»´í£¬ÖÕÓÚÕÒµ½ÁËlinuxÏÂÒ»¸ö±È½ÏÂúÒâµÄC++¿ª·¢»·¾³¡£
ÒÔǰдC++¶¼ÊÇÔÚEclipseÏÂдµÄ£¬µ«EclipseÆô¶¯Âý£¬ÅäÖÃÂé·³£¬ºÍjavaÒ»ÆðÓõÄʱºòºÜÈÝÒ׳ö´í£¬Óõĺܲ»Ë¬£¬µ±È»¸ ......
ת×Ô¡¾http://tech.ddvip.com/2008-08/121825219252306_3.html¡¿
ÄÚÈÝÕªÒª£ºÒ»Ö±ÒÔÀ´¶¼¾õµÃprintfËÆºõÊÇcÓïÑÔ¿âÖй¦ÄÜ×îÇ¿´óµÄº¯ÊýÖ®Ò»£¬²»½öÒòΪËüÄܸñʽ»¯Êä³ö£¬¸üÔÚÓÚËüµÄ²ÎÊý¸öÊýûÓÐÏÞÖÆ£¬Òª¼¸¸ö¾Í¸ø¼¸¸ö£¬À´Õß²»¾Ü¡£printfÕâÖÖ¶Ô²ÎÊý¸öÊýºÍ²ÎÊýÀàÐ͵ÄÇ¿´óÊÊÓ¦ÐÔ£¬ÈÃÈ˲úÉúÁ˶ÔËü½øÐÐ̽Ë÷µÄŨºñÐËȤ¡£
¡¾1. ʹÓÃÇéÐ ......