C++ѧϰ±Ê¼Ç--Linuxϱà³Ì
Ò»¡¢¹ØÓÚBoostµÄʹÓ㬼¸ÖÖ³£Ó÷½·¨£¬Ö»ÊÇ×Ô¼º¹¤×÷¡¢Ñ§Ï°ÖÐ×ܽáµÄ£¬ÓÐЩ·½·¨µÄÈ·ÓÐЩ·±Ëö£¬ÄÜÂú×ãÐèÇó£¬Ó¦¸Ã»¹Óиü¼Ó¼òµ¥¿ì½ÝµÄ·½Ê½£¬´ý¸Ä½ø¡£
1¡¢ÅжÏ×Ö·û´®ÓëÕýÔò±í´ïʽÊÇ·ñÆ¥Å䣨ÍêÈ«Æ¥Å䣩
bool IsMatch(const char* data,const char * regx)
{
boost::regex expression(regx);
string str(data);
if(boost::regex_match(str, expression))
{
return true;
}
return false;
}
2.1¡¢°´Ä³Ò»×Ö·û´®½øÐзָî²Ù×÷£¬²¢´æ´¢µ½vectorÖС£
void split1(const char* data,boost::regex expression,vector<string> &dataVector)
{
string str1(data);//½«char *ת»¯ÎªstringÀàÐÍ
boost::sregex_token_iterator p(str1.begin( ), str1.end( ), expression, -1);
boost::sregex_token_iterator end;
const char *start=NULL,*endp;
while ( ......
C++ѧϰ±Ê¼Ç--Linuxϱà³Ì
Ò»¡¢¹ØÓÚBoostµÄʹÓ㬼¸ÖÖ³£Ó÷½·¨£¬Ö»ÊÇ×Ô¼º¹¤×÷¡¢Ñ§Ï°ÖÐ×ܽáµÄ£¬ÓÐЩ·½·¨µÄÈ·ÓÐЩ·±Ëö£¬ÄÜÂú×ãÐèÇó£¬Ó¦¸Ã»¹Óиü¼Ó¼òµ¥¿ì½ÝµÄ·½Ê½£¬´ý¸Ä½ø¡£
1¡¢ÅжÏ×Ö·û´®ÓëÕýÔò±í´ïʽÊÇ·ñÆ¥Å䣨ÍêÈ«Æ¥Å䣩
bool IsMatch(const char* data,const char * regx)
{
boost::regex expression(regx);
string str(data);
if(boost::regex_match(str, expression))
{
return true;
}
return false;
}
2.1¡¢°´Ä³Ò»×Ö·û´®½øÐзָî²Ù×÷£¬²¢´æ´¢µ½vectorÖС£
void split1(const char* data,boost::regex expression,vector<string> &dataVector)
{
string str1(data);//½«char *ת»¯ÎªstringÀàÐÍ
boost::sregex_token_iterator p(str1.begin( ), str1.end( ), expression, -1);
boost::sregex_token_iterator end;
const char *start=NULL,*endp;
while ( ......
ÈçºÎÖÕÖ¹Ï̵߳ÄÔËÐУ¨C/C++£©
ÏëÒªÖÕÖ¹Ï̵߳ÄÔËÐУ¬¿ÉÒÔʹÓÃÒÔÏ·½·¨£º
1¡¢Ï̺߳¯Êý·µ»Ø£¨×îºÃʹÓø÷½·¨£©¡£
2¡¢Í¨¹ýµ÷ÓÃExitThreadº¯Êý£¬Ï߳̽«×ÔÐг·Ïû£¨×îºÃ²»Ê¹Óø÷½·¨£©¡£
3¡¢Í¬Ò»¸ö½ø³Ì»òÁíÒ»¸ö½ø³ÌÖеÄÏ̵߳÷ÓÃTerminateThreadº¯Êý£¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
4¡¢ExitProcessºÍTerminateProcessº¯ÊýÒ²¿ÉÒÔÓÃÀ´ÖÕÖ¹Ï̵߳ÄÔËÐУ¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
ÏÂÃ潫Ïêϸ½éÉÜÖÕÖ¹Ïß³ÌÔËÐеķ½·¨£º1-4£¬²¢ËµÃ÷Ïß³ÌÖÕÖ¹ÔËÐÐʱ»á³öÏÖºÎÖÖÇé¿ö£º5¡£
1¡¢Ï̺߳¯Êý·µ»Ø
ʼÖÕ¶¼Ó¦¸Ã½«Ïß³ÌÉè¼Æ³ÉÕâÑùµÄÐÎʽ£¬¼´µ±ÏëÒªÏß³ÌÖÕÖ¹ÔËÐÐʱ£¬ËüÃǾÍÄܹ»·µ»Ø¡£ÕâÊÇÈ·±£ËùÓÐÏß³Ì×ÊÔ´±»ÕýÈ·µØÇå³ýµÄΨһ°ì·¨¡£
Èç¹ûÏß³ÌÄܹ»·µ»Ø£¬¾Í¿ÉÒÔÈ·±£ÏÂÁÐÊÂÏîµÄʵÏÖ£º
£¨1£©ÔÚÏ̺߳¯ÊýÖд´½¨µÄËùÓÐC++¶ÔÏó¾ù½«Í¨¹ýËüÃǵij·Ïûº¯ÊýÕýÈ·µØ³·Ïû¡£
£¨2£©²Ù×÷ϵͳ½«ÕýÈ·µØÊÍ·ÅÏ̶߳ÑջʹÓõÄÄÚ´æ¡£
£¨3£©ÏµÍ³½«Ï̵߳ÄÍ˳ö´úÂ루ÔÚÏ̵߳ÄÄں˶ÔÏóÖÐά»¤£©ÉèÖÃΪÏ̺߳¯ÊýµÄ·µ»ØÖµ¡£
£¨4£©ÏµÍ³½«µÝ¼õÏß³ÌÄں˶ÔÏóµÄʹÓüÆÊý¡£
2¡¢ExitThreadº¯Êý
¿ÉÒÔÈÃÏ̵߳÷ÓÃExitThreadº¯Êý£¬ÒÔ±ãÇ¿ÖÆÏß³ÌÖÕÖ¹ÔËÐУº
º¯ÊýÔÐÍ£º
VOID ExitThread(DWORD dwExitCode);
¸Ãº¯Êý½«ÖÕÖ¹Ï̵߳ÄÔËÐУ¬²¢µ¼Ö² ......
ÈçºÎÖÕÖ¹Ï̵߳ÄÔËÐУ¨C/C++£©
ÏëÒªÖÕÖ¹Ï̵߳ÄÔËÐУ¬¿ÉÒÔʹÓÃÒÔÏ·½·¨£º
1¡¢Ï̺߳¯Êý·µ»Ø£¨×îºÃʹÓø÷½·¨£©¡£
2¡¢Í¨¹ýµ÷ÓÃExitThreadº¯Êý£¬Ï߳̽«×ÔÐг·Ïû£¨×îºÃ²»Ê¹Óø÷½·¨£©¡£
3¡¢Í¬Ò»¸ö½ø³Ì»òÁíÒ»¸ö½ø³ÌÖеÄÏ̵߳÷ÓÃTerminateThreadº¯Êý£¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
4¡¢ExitProcessºÍTerminateProcessº¯ÊýÒ²¿ÉÒÔÓÃÀ´ÖÕÖ¹Ï̵߳ÄÔËÐУ¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
ÏÂÃ潫Ïêϸ½éÉÜÖÕÖ¹Ïß³ÌÔËÐеķ½·¨£º1-4£¬²¢ËµÃ÷Ïß³ÌÖÕÖ¹ÔËÐÐʱ»á³öÏÖºÎÖÖÇé¿ö£º5¡£
1¡¢Ï̺߳¯Êý·µ»Ø
ʼÖÕ¶¼Ó¦¸Ã½«Ïß³ÌÉè¼Æ³ÉÕâÑùµÄÐÎʽ£¬¼´µ±ÏëÒªÏß³ÌÖÕÖ¹ÔËÐÐʱ£¬ËüÃǾÍÄܹ»·µ»Ø¡£ÕâÊÇÈ·±£ËùÓÐÏß³Ì×ÊÔ´±»ÕýÈ·µØÇå³ýµÄΨһ°ì·¨¡£
Èç¹ûÏß³ÌÄܹ»·µ»Ø£¬¾Í¿ÉÒÔÈ·±£ÏÂÁÐÊÂÏîµÄʵÏÖ£º
£¨1£©ÔÚÏ̺߳¯ÊýÖд´½¨µÄËùÓÐC++¶ÔÏó¾ù½«Í¨¹ýËüÃǵij·Ïûº¯ÊýÕýÈ·µØ³·Ïû¡£
£¨2£©²Ù×÷ϵͳ½«ÕýÈ·µØÊÍ·ÅÏ̶߳ÑջʹÓõÄÄÚ´æ¡£
£¨3£©ÏµÍ³½«Ï̵߳ÄÍ˳ö´úÂ루ÔÚÏ̵߳ÄÄں˶ÔÏóÖÐά»¤£©ÉèÖÃΪÏ̺߳¯ÊýµÄ·µ»ØÖµ¡£
£¨4£©ÏµÍ³½«µÝ¼õÏß³ÌÄں˶ÔÏóµÄʹÓüÆÊý¡£
2¡¢ExitThreadº¯Êý
¿ÉÒÔÈÃÏ̵߳÷ÓÃExitThreadº¯Êý£¬ÒÔ±ãÇ¿ÖÆÏß³ÌÖÕÖ¹ÔËÐУº
º¯ÊýÔÐÍ£º
VOID ExitThread(DWORD dwExitCode);
¸Ãº¯Êý½«ÖÕÖ¹Ï̵߳ÄÔËÐУ¬²¢µ¼Ö² ......
JAVAºÍC++¶¼ÊÇÃæÏò¶ÔÏóÓïÑÔ¡£Ò²¾ÍÊÇ˵£¬ËüÃǶ¼Äܹ»ÊµÏÖÃæÏò¶ÔÏó˼Ï루·â×°£¬¼Ì³Ë£¬¶à̬£©¡£
C++Äܱ»²Ù×÷ϵͳ£¨Window£¬Linux£©Ö±½ÓÔËÐУ¬¶øJava²»ÐУ¬ÐèÒªÓиöJVM¡£
javaÓïÑÔ¸ø¿ª·¢ÈËÔ±ÌṩÁ˸üΪ¼ò½àµÄÓï·¨£»È¡ÏûÁËÖ¸Õë´øÀ´¸ü¸ßµÄ´úÂëÖÊÁ¿£»ÍêÈ«ÃæÏò¶ÔÏ󣬶ÀÌصÄÔËÐлúÖÆÊÇÆä¾ßÓÐÌìÈ»µÄ¿ÉÒÆÖ²ÐÔ¡£
1£®Ö¸Õë
JAVAÓïÑÔÈñà³ÌÕßÎÞ·¨ÕÒµ½Ö¸ÕëÀ´Ö±½Ó·ÃÎÊÄÚ´æÎÞÖ¸Õ룬²¢ÇÒÔöÌíÁË×Ô¶¯µÄÄÚ´æ¹ÜÀí¹¦ÄÜ£¬´Ó¶øÓÐЧµØ·ÀÖ¹ÁËc£¯c++ÓïÑÔÖÐÖ¸Õë²Ù×÷ʧÎó£¬ÈçÒ°Ö¸ÕëËùÔì³ÉµÄϵͳ±ÀÀ£¡£µ«Ò²²»ÊÇ˵JAVAûÓÐÖ¸Õ룬ÐéÄâ»úÄÚ²¿»¹ÊÇʹÓÃÁËÖ¸Õ룬ֻÊÇÍâÈ˲»µÃʹÓöøÒÑ¡£ÕâÓÐÀûÓÚJava³ÌÐòµÄ°²È«¡£
2.¶àÖؼ̳Ð
c++Ö§³Ö¶àÖؼ̳У¬ÕâÊÇc++µÄÒ»¸öÌØÕ÷£¬ËüÔÊÐí¶à¸¸ÀàÅÉÉúÒ»¸öÀà¡£¾¡¹Ü¶àÖؼ̳й¦ÄܺÜÇ¿£¬µ«Ê¹Óø´ÔÓ£¬¶øÇÒ»áÒýÆðÐí¶àÂé·³£¬±àÒë³ÌÐòʵÏÖËüÒ²ºÜ²»ÈÝÒס£Java²»Ö§³Ö¶àÖؼ̳У¬µ«ÔÊÐíÒ»¸öÀà¼Ì³Ð¶à¸ö½Ó¿Ú(extends+implement)£¬ÊµÏÖÁËc++¶àÖؼ̳еŦÄÜ£¬ÓÖ±ÜÃâÁËc++ÖеĶàÖؼ̳ÐʵÏÖ·½Ê½´øÀ´µÄÖî¶à²»±ã¡£ ......
JAVAºÍC++¶¼ÊÇÃæÏò¶ÔÏóÓïÑÔ¡£Ò²¾ÍÊÇ˵£¬ËüÃǶ¼Äܹ»ÊµÏÖÃæÏò¶ÔÏó˼Ï루·â×°£¬¼Ì³Ë£¬¶à̬£©¡£
C++Äܱ»²Ù×÷ϵͳ£¨Window£¬Linux£©Ö±½ÓÔËÐУ¬¶øJava²»ÐУ¬ÐèÒªÓиöJVM¡£
javaÓïÑÔ¸ø¿ª·¢ÈËÔ±ÌṩÁ˸üΪ¼ò½àµÄÓï·¨£»È¡ÏûÁËÖ¸Õë´øÀ´¸ü¸ßµÄ´úÂëÖÊÁ¿£»ÍêÈ«ÃæÏò¶ÔÏ󣬶ÀÌصÄÔËÐлúÖÆÊÇÆä¾ßÓÐÌìÈ»µÄ¿ÉÒÆÖ²ÐÔ¡£
1£®Ö¸Õë
JAVAÓïÑÔÈñà³ÌÕßÎÞ·¨ÕÒµ½Ö¸ÕëÀ´Ö±½Ó·ÃÎÊÄÚ´æÎÞÖ¸Õ룬²¢ÇÒÔöÌíÁË×Ô¶¯µÄÄÚ´æ¹ÜÀí¹¦ÄÜ£¬´Ó¶øÓÐЧµØ·ÀÖ¹ÁËc£¯c++ÓïÑÔÖÐÖ¸Õë²Ù×÷ʧÎó£¬ÈçÒ°Ö¸ÕëËùÔì³ÉµÄϵͳ±ÀÀ£¡£µ«Ò²²»ÊÇ˵JAVAûÓÐÖ¸Õ룬ÐéÄâ»úÄÚ²¿»¹ÊÇʹÓÃÁËÖ¸Õ룬ֻÊÇÍâÈ˲»µÃʹÓöøÒÑ¡£ÕâÓÐÀûÓÚJava³ÌÐòµÄ°²È«¡£
2.¶àÖؼ̳Ð
c++Ö§³Ö¶àÖؼ̳У¬ÕâÊÇc++µÄÒ»¸öÌØÕ÷£¬ËüÔÊÐí¶à¸¸ÀàÅÉÉúÒ»¸öÀà¡£¾¡¹Ü¶àÖؼ̳й¦ÄܺÜÇ¿£¬µ«Ê¹Óø´ÔÓ£¬¶øÇÒ»áÒýÆðÐí¶àÂé·³£¬±àÒë³ÌÐòʵÏÖËüÒ²ºÜ²»ÈÝÒס£Java²»Ö§³Ö¶àÖؼ̳У¬µ«ÔÊÐíÒ»¸öÀà¼Ì³Ð¶à¸ö½Ó¿Ú(extends+implement)£¬ÊµÏÖÁËc++¶àÖؼ̳еŦÄÜ£¬ÓÖ±ÜÃâÁËc++ÖеĶàÖؼ̳ÐʵÏÖ·½Ê½´øÀ´µÄÖî¶à²»±ã¡£ ......
JAVAºÍC++¶¼ÊÇÃæÏò¶ÔÏóÓïÑÔ¡£Ò²¾ÍÊÇ˵£¬ËüÃǶ¼Äܹ»ÊµÏÖÃæÏò¶ÔÏó˼Ï루·â×°£¬¼Ì³Ë£¬¶à̬£©¡£
C++Äܱ»²Ù×÷ϵͳ£¨Window£¬Linux£©Ö±½ÓÔËÐУ¬¶øJava²»ÐУ¬ÐèÒªÓиöJVM¡£
javaÓïÑÔ¸ø¿ª·¢ÈËÔ±ÌṩÁ˸üΪ¼ò½àµÄÓï·¨£»È¡ÏûÁËÖ¸Õë´øÀ´¸ü¸ßµÄ´úÂëÖÊÁ¿£»ÍêÈ«ÃæÏò¶ÔÏ󣬶ÀÌصÄÔËÐлúÖÆÊÇÆä¾ßÓÐÌìÈ»µÄ¿ÉÒÆÖ²ÐÔ¡£
1£®Ö¸Õë
JAVAÓïÑÔÈñà³ÌÕßÎÞ·¨ÕÒµ½Ö¸ÕëÀ´Ö±½Ó·ÃÎÊÄÚ´æÎÞÖ¸Õ룬²¢ÇÒÔöÌíÁË×Ô¶¯µÄÄÚ´æ¹ÜÀí¹¦ÄÜ£¬´Ó¶øÓÐЧµØ·ÀÖ¹ÁËc£¯c++ÓïÑÔÖÐÖ¸Õë²Ù×÷ʧÎó£¬ÈçÒ°Ö¸ÕëËùÔì³ÉµÄϵͳ±ÀÀ£¡£µ«Ò²²»ÊÇ˵JAVAûÓÐÖ¸Õ룬ÐéÄâ»úÄÚ²¿»¹ÊÇʹÓÃÁËÖ¸Õ룬ֻÊÇÍâÈ˲»µÃʹÓöøÒÑ¡£ÕâÓÐÀûÓÚJava³ÌÐòµÄ°²È«¡£
2.Àà
2.1 C++Àà
Àà³ÉÔ±·ÃÎÊ¿ØÖÆÊôÐÔ£º¹«ÓУ¬Ë½ÓУ¬±£»¤¡£±£»¤Óë˽ÓÐÀàËÆ£¬²î±ðÔÚÓڼ̳йý³ÌÖжԲúÉúµÄÐÂÀàµÄÓ°Ï첻ͬ¡£
ϵͳĬÈÏΪprivate ¼Ì³Ð
Ðé»ùÀࣺ
ijÀàµÄ²¿·Ö»òÈ«²¿»ùÀà´ÓÒ»¸ö¹²Í¬»ùÀàÅÉÉú³öÀ´Ê±£¬½«¹²Í¬»ùÀàÉèΪÐé»ùÀ࣬´Ó²»Í¬Â·¾¶¼Ì³Ð¹ýÀ´µÄͬÃûÊý¾Ý³ÉÔ±ÔÚÄÚ´æÖÐÖ»ÓÐÒ»¸ö¿½±´£¬½â¾öͬÃû³ÉÔ±µÄΨһ±êʶÎÊÌâ¡£
Ð麯Êý£º
½â¾öͨ¹ý»ùÀà¶ÔÏóµÄÖ¸Õëµ÷ÓõÄÖ»ÊÇ´Ó»ùÀà¼Ì³ÐµÄº¯Êý³ÉÔ±£¬¶ø²»ÊÇÅÉÉúÀàÐÂÔöµÄͬÃûº¯Êý¡£
´¿Ð麯Êý£º
ÔÚ»ùÀàÖÐֻ˵Ã÷º¯ÊýÔÐÍ£¬¹æ¶¨Õû¸öÀà×åµÄͳһ½Ó¿ÚÐÎʽ£ ......
¹þ¹þ£¡ÓÐÐÒÔÚijÍøÕ¾·¢ÏÖÕâƪÎÄÕ£¬¶Á°Õ£¬¾õµÃÂùÓеÀÀí£¬·¢À´´ó¼ÒÒ»Æð¹²ÃãÖ®
×ÜÊDZ»Í¬Ñ§ÃÇÎʵ½£¬ÈçºÎѧϰCºÍC++²Å²»Ã£È»£¬²Å²»ÊÇÂÒѧ£¬ÏëÁËһϣ¬ÕâÀï¸ø³öÒ»¸ö×ܵĻظ´¡£
' J$ |0 ?! p% w" t5 D6 D: c9 |0 B
¡¡¡¡Ò»¼ÒÖ®ÑÔ£¬»¶ÓÅÄש¹þ¡£
¡¡¡¡1¡¢¿ÉÒÔ¿¼ÂÇÏÈѧϰC.
/ U$ X+ X/ P; Y: h" I
¡¡¡¡´ó¶àÊýʱºò£¬ÎÒÃÇѧϰÓïÑÔµÄÄ¿µÄ£¬²»ÊÇΪÁ˳ÉΪһ¸öÓïÑÔר¼Ò£¬¶øÊÇÏ£Íû³ÉΪһ¸ö½â¾öÎÊÌâµÄר¼Ò¡£×öÒ»¸öÓÐÓõijÌÐòÔ±£¬×öÒ»¸ö׬ǮµÄ³ÌÐòÔ±¡£ÎÒÃǵļÛÖµ£¬½«ÌåÏÖÔÚ¿Í»§¼ÛÖµÉÏ£¬¶ø²»ÊÇÓïÑÔдµÃºÃ²»ºÃ¿´¡£ 9 l( K9 ? S/ v4 M J4 s0 Z: {
. z. v. ~) V4 ]" ^& t
¡¡¡¡C++ÊÇCµÄÒ»¸öÃæÏò¶ÔÏóµÄ½âÊÍ£¬C++ΪCÀ©³äÁË´ó¹æÄ£¹¤³ÌÓ¦Ó㬸´ÔÓµÄϵͳ½á¹¹µÄ×éÖ¯ºÍÕÆ¿Ø·½·¨£¬µ«ÊÇ£¬ÎÒÈÏΪ£¬C++¹Ç×ÓÀﻹÊÇCµÄ¡£ % ~5 b8 @* x( t, z8 {+ e! L* Z
: e& r8 `; ~: \7 m6 `6 g/ m
¡¡¡¡±Ï¾¹£¬½â¾ö¾ßÌåÎÊÌ⣬ÿ¸öº¯ÊýÄÚ²¿£¬¶¼ÊÇÓÃCµÄ·½Ê½Ð´³ÌÐò£¬»¹ÊÇÃæÏò¹ý³ÌµÄ¡£ 0 h a" n9 G+ p, ]6 R
X4 o/ Q3 z% Z0 s, h$ A
¡¡¡¡Òò´Ë£¬ÏëҪѧϰºÃC++£¬ÎҵĽ¨Ò飬ÏÈѧϰC£¬ÏÈѧ½â¾öÎÊÌâµÄÄÜÁ¦£¬ÔÙÌÖÂÛ½â ......
¹þ¹þ£¡ÓÐÐÒÔÚijÍøÕ¾·¢ÏÖÕâƪÎÄÕ£¬¶Á°Õ£¬¾õµÃÂùÓеÀÀí£¬·¢À´´ó¼ÒÒ»Æð¹²ÃãÖ®
×ÜÊDZ»Í¬Ñ§ÃÇÎʵ½£¬ÈçºÎѧϰCºÍC++²Å²»Ã£È»£¬²Å²»ÊÇÂÒѧ£¬ÏëÁËһϣ¬ÕâÀï¸ø³öÒ»¸ö×ܵĻظ´¡£
' J$ |0 ?! p% w" t5 D6 D: c9 |0 B
¡¡¡¡Ò»¼ÒÖ®ÑÔ£¬»¶ÓÅÄש¹þ¡£
¡¡¡¡1¡¢¿ÉÒÔ¿¼ÂÇÏÈѧϰC.
/ U$ X+ X/ P; Y: h" I
¡¡¡¡´ó¶àÊýʱºò£¬ÎÒÃÇѧϰÓïÑÔµÄÄ¿µÄ£¬²»ÊÇΪÁ˳ÉΪһ¸öÓïÑÔר¼Ò£¬¶øÊÇÏ£Íû³ÉΪһ¸ö½â¾öÎÊÌâµÄר¼Ò¡£×öÒ»¸öÓÐÓõijÌÐòÔ±£¬×öÒ»¸ö׬ǮµÄ³ÌÐòÔ±¡£ÎÒÃǵļÛÖµ£¬½«ÌåÏÖÔÚ¿Í»§¼ÛÖµÉÏ£¬¶ø²»ÊÇÓïÑÔдµÃºÃ²»ºÃ¿´¡£ 9 l( K9 ? S/ v4 M J4 s0 Z: {
. z. v. ~) V4 ]" ^& t
¡¡¡¡C++ÊÇCµÄÒ»¸öÃæÏò¶ÔÏóµÄ½âÊÍ£¬C++ΪCÀ©³äÁË´ó¹æÄ£¹¤³ÌÓ¦Ó㬸´ÔÓµÄϵͳ½á¹¹µÄ×éÖ¯ºÍÕÆ¿Ø·½·¨£¬µ«ÊÇ£¬ÎÒÈÏΪ£¬C++¹Ç×ÓÀﻹÊÇCµÄ¡£ % ~5 b8 @* x( t, z8 {+ e! L* Z
: e& r8 `; ~: \7 m6 `6 g/ m
¡¡¡¡±Ï¾¹£¬½â¾ö¾ßÌåÎÊÌ⣬ÿ¸öº¯ÊýÄÚ²¿£¬¶¼ÊÇÓÃCµÄ·½Ê½Ð´³ÌÐò£¬»¹ÊÇÃæÏò¹ý³ÌµÄ¡£ 0 h a" n9 G+ p, ]6 R
X4 o/ Q3 z% Z0 s, h$ A
¡¡¡¡Òò´Ë£¬ÏëҪѧϰºÃC++£¬ÎҵĽ¨Ò飬ÏÈѧϰC£¬ÏÈѧ½â¾öÎÊÌâµÄÄÜÁ¦£¬ÔÙÌÖÂÛ½â ......
ÍøÉÏËÑË÷ÁËÒ»´ó¶ÑÈ¥µô/*ºÍ*/Ö®¼ä×¢Ê͵ĴúÂë,¾ÍÏñ<The C Programming Language>Á·Ï°1-23ÀïÓÐÈË˵µÄÒ»Ñù
´ó²¿·Ö¶¼»á±»ÒÔϵijÌÐòbroken,Õâ¸ö¹¦ÄÜ¿´ÆðÀ´¼òµ¥,ʵ¼ÊÉϺÜÓÐÄѶÈ.ÍøÉÏʵÏֵĴúÂë,³ýÁËÎÒÕÒµ½µÄÒ»¸öÓÃÎļþÖ¸ÕëʵÏÖµÄûÓÐÎÊÌâÍâ,ÆäÓàµÄ¶¼´æÔÚ¸÷ÖÖbug,²»ÐŵĻ°¾ÍÓÃÒÔϵijÌÐò²âÊÔÒ»ÏÂ:-),µ±È»Õâ¸ö³ÌÐòÒ²²»¹»ÍêÉÆ.
»¹ÊÇÓÐÏÞ״̬×Ô¶¯»úʵÏÖÆðÀ´¸üÑϽ÷Ò²ÈÝÒ×Àí½âµÃ¶à:
/* krx123tp.c - a test program to serve as input to krx123*.c
*
* This is a shameless copy of Ben Pfaff's solution, to which I have
* added a few extra statements to further test the candidate programs
* for this exercise. As Ben says, this program already contains lots
* of examples of comments and not-quite-comments. I've just made it
* a little tougher.
*
*/
/* K&R2 1-23: Write a program to remove all comments from a C program.
Don't forget to handle quoted strings and character constants
properly. C comments do not nest.
This solution does not deal with other special cases, such as
trigraphs, line c ......
ÍøÉÏËÑË÷ÁËÒ»´ó¶ÑÈ¥µô/*ºÍ*/Ö®¼ä×¢Ê͵ĴúÂë,¾ÍÏñ<The C Programming Language>Á·Ï°1-23ÀïÓÐÈË˵µÄÒ»Ñù
´ó²¿·Ö¶¼»á±»ÒÔϵijÌÐòbroken,Õâ¸ö¹¦ÄÜ¿´ÆðÀ´¼òµ¥,ʵ¼ÊÉϺÜÓÐÄѶÈ.ÍøÉÏʵÏֵĴúÂë,³ýÁËÎÒÕÒµ½µÄÒ»¸öÓÃÎļþÖ¸ÕëʵÏÖµÄûÓÐÎÊÌâÍâ,ÆäÓàµÄ¶¼´æÔÚ¸÷ÖÖbug,²»ÐŵĻ°¾ÍÓÃÒÔϵijÌÐò²âÊÔÒ»ÏÂ:-),µ±È»Õâ¸ö³ÌÐòÒ²²»¹»ÍêÉÆ.
»¹ÊÇÓÐÏÞ״̬×Ô¶¯»úʵÏÖÆðÀ´¸üÑϽ÷Ò²ÈÝÒ×Àí½âµÃ¶à:
/* krx123tp.c - a test program to serve as input to krx123*.c
*
* This is a shameless copy of Ben Pfaff's solution, to which I have
* added a few extra statements to further test the candidate programs
* for this exercise. As Ben says, this program already contains lots
* of examples of comments and not-quite-comments. I've just made it
* a little tougher.
*
*/
/* K&R2 1-23: Write a program to remove all comments from a C program.
Don't forget to handle quoted strings and character constants
properly. C comments do not nest.
This solution does not deal with other special cases, such as
trigraphs, line c ......