Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ʹÓà gperf ʵÏÖ¸ßЧµÄ C/C++ ÃüÁîÐд¦Àí


ʹÓà gperf ʵÏÖ¸ßЧµÄ C/C++ ÃüÁîÐд¦Àí
GNU ÍêÃÀ£¨gperf£©É¢Áк¯ÊýÉú³ÉÆ÷¼ò»¯¸´ÔÓµÄÊäÈë×Ö·û´®
ÎĵµÑ¡Ïî
¼¶±ð£º Öм¶
Arpan Sen
(arpan@syncad.com
), ¼¼ÊõÖ÷¹Ü, Synapti Computer Aided Design Pvt Ltd
2007 Äê 9 ÔÂ 10 ÈÕ
GNU µÄ gperf ¹¤¾ßÊÇÒ»ÖÖ “ÍêÃÀµÄ” É¢Áк¯Êý£¬¿ÉÒÔΪÓû§ÌṩµÄÒ»×éÌض¨×Ö·û´®Éú³ÉÉ¢ÁÐ±í¡¢É¢Áк¯ÊýºÍ²éÕÒº¯ÊýµÄ C/C++ ´úÂ롣ͨ¹ý±¾ÎÄѧϰÈçºÎʹÓà gperf ʵÏÖ C/C++ ´úÂëÖиßЧµÄÃüÁîÐд¦Àí¡£
ÃüÁîÐд¦ÀíºÍ gperf µÄ×÷ÓÃ
ÃüÁîÐд¦ÀíÒ»Ö±ÒÔÀ´¶¼ÊÇÈí¼þ¿ª·¢ÖÐ×îÈÝÒ×±»ºöÊÓµÄÁìÓò¡£¼¸ºõËùÓбȽϸ´ÔÓµÄÈí¼þ¶¼¾ßÓÐһЩ¿ÉÓõÄÃüÁîÐÐÑ¡Ïî¡£ÊÂʵÉÏ£¬´óÁ¿ if-else
Óï¾ä¾­³£±»ÓÃÀ´´¦ÀíÓû§ÊäÈ룬Òò´Ëά»¤ÕâÖÖÒÅÁô´úÂëÏ൱·Ñʱ£¬¶Ô×ÊÉî³ÌÐòÔ±ÒàÊÇÈç´Ë¡£ÕâÖÖÇéÐÎÏ£¬ºÜ¶à C ¿ª·¢ÈËԱͨ³£Ê¹ÓÃÈß³¤£¨Í¨³£¶¼Ç¶Ì×ʹÓã©µÄ if-else
Óï¾ä£¬ÒÔ¼° ANSI C ¿âº¯Êý£¬ÀýÈç strcmp
¡¢strcasecmp
ºÍ strtok
×÷Ϊ²¹³ä£¬ÈçÇåµ¥ 1 Ëùʾ¡£

Çåµ¥ 1. C ÓïÑÔÑùʽµÄÃüÁîÐд¦Àí

if (strtok(cmdstring, "+dumpdirectory"))
{
// code for printing help messages goes here
}
else if (strtok(cmdstring, "+dumpfile"))
{
// code for printing version info goes here
}
C++ ¿ª·¢ÈËÔ±²¢Ã»ÓÐʹÓûùÓÚ ANSI C µÄÓ¦ÓóÌÐò±à³Ì½Ó¿Ú£¬¶øÊÇʹÓñê׼ģ°å¿â£¨Standard Template Library£¬STL£©ÖеÄ×Ö·û´®¡£¾¡¹ÜÈç´Ë£¬ÈÔÈ»ÎÞ·¨±ÜÃâʹÓÃǶÌ×µÄ if-else
ÐòÁÐÓï¾ä¡£ºÜÃ÷ÏÔ£¬Ëæ×ÅÃüÁîÐÐÑ¡Ïî²»¶ÏÔö¼Ó£¬ÕâÖÖ·½·¨È±·¦¿ÉÉìËõÐÔ¡£¶ÔÓÚ¾ßÓÐ N ¸öÑ¡ÏîµÄµäÐͳÌÐòµ÷Ó㬴úÂë×îÖÕÖ´ÐÐ 0£¨N2
£©±È½Ï¡£ÎªÁËÉú³ÉÔËÐиü¼Ó¿ì½Ý²¢Ò×ÓÚά»¤µÄ´úÂ룬ʹÓÃÉ¢Áбí´æ´¢ÃüÁîÐÐÑ¡ÏʹÓÃÉ¢ÁÐÑéÖ¤Óû§Ö¸¶¨µÄÊäÈ룬ÕâÖÖ·½·¨·Ç³£ÓаïÖú¡£
Õâ¾ÍÊÇ gperf °çÑݵĽÇÉ«¡£Ëü½«´ÓÔ¤¶¨µÄÓÐЧÃüÁîÐÐÑ¡ÏîÁбíºÍʱ¼ä¸´ÔÓ¶ÈΪ O(1) µÄ²éÕÒº¯ÊýÖÐÉú³ÉÒ»¸öÉ¢ÁÐ±í¡£Òò´Ë£¬¶ÔÓÚ¾ßÓÐ N ¸öÑ¡ÏîµÄµäÐͳÌÐòµ÷Ó㬴úÂëÖ»ÐèÖ´ÐÐ O(N) [N*O(1)]
±È½Ï — ÕâÊǶÔÒÅÁô´úÂëµÄ¾Þ´ó¸Ä½ø¡£
 
Gperf ʹÓÃģʽ
Gperf ½«´ÓÓû§ÌṩµÄÎļþÖУ¨Í¨³£Ê¹Óà .gperf ×÷ΪÀ©Õ¹Ãû£¬µ«²»×öÇ¿ÖÆÒªÇ󣩗 ÀýÈ磬commandoptions.gperf — ²¢Õë¶ÔÉ¢ÁÐ±í¡¢É¢ÁкͲéÕÒ·½·¨Éú³É C/C++ Ô´´úÂë¡£ËùÓдúÂë±»¶¨Ïòµ½±ê×¼Êä³ö£¬È»ºó±ØÐëÖض¨Ïòµ½ÀàËÆÏÂÃæµÄÎļþ£º
gperf -L C++ command_line_options.gperf > p


Ïà¹ØÎĵµ£º

console mode ÖÐʹÓà C/C++ ±àÒëÆ÷

jjhou.csdn.netÀïÃæÓÐ  
  --------------------------------------------------------------------------------  
   
  ÔÚ   console   mode   ÖÐʹÓà   C/C++   ±àÒëÆ÷  
  ºî½Ý   1999.04.08  
   
    ......

VC2005ÖÐCÔËÐÐʱ¿âÑ¡Ôñ²»µ±µ¼ÖµÄÁ´½ÓÎÊÌâ¼°½â¾ö·½°¸

VC2005ÖÐCÔËÐÐʱ¿âÑ¡Ôñ²»µ±µ¼ÖµÄÁ´½ÓÎÊÌâ¼°½â¾ö·½°¸
 
ÔÚMicrosoft Visual C++ 2005ÖУ¬Èç¹ûÒ»¸öEXEÖ÷¹¤³ÌÓ¦ÓóÌÐòҪʹÓÃÒ»¸ö»ò¼¸¸ö¾²Ì¬LIB¿â£¬ÄÇôÁ´½Óʱ¾­³£»áÓöµ½·ûºÅÖظ´¶¨ÒåµÄ´íÎó£¬Èç¹ûÅųý¿â²»µ±ÓÖ»áÓöµ½ÕÒ²»µ½Ä³Ð©·ûºÅµÄÎÊÌ⣬Èç¹ûÇ¿ÖÆʹÓà /forceÑ¡ÏîÁ´½Ó¹ýÈ¥ÓÖ¿ÉÄÜ·¢ÉúһЩÒâÏë²»µ½µÄÔËÐÐʱÎÊÌâ¡£
  ......

ʹÓÃc#´´½¨sql serverµÄ´æ´¢¹ý³Ì_c#Ó¦ÓÃ1

½éÉÜ
ͨ³££¬Ñз¢ÈËԱʹÓõÄÊÇT-SQLÀ´´´½¨SQL ServerµÄ´æ´¢¹ý³Ì¡¢º¯ÊýºÍ´¥·¢Æ÷¡£ ¶øÏÖÔÚµÄSQL Server 2005ÒÑÍêÈ«Ö§³Ö.NETͨÓÃÓïÑÔÔËÐÐʱ£¨CLR£©ÁË¡£ Õâ¾ÍÒâζ×Å£¬ÄúÄܹ»Ê¹ÓÃ.NETµÄÓïÑÔ£¬ÈçC#¡¢VB.NETÖ®ÀàµÄÀ´Ñз¢SQL ServerµÄ´æ´¢¹ý³Ì¡¢º¯ÊýºÍ´¥·¢Æ÷¡£ SQL Server ºÍ CLR µÄ¼¯³É¸øÎÒÃÇ´øÀ´ÁËn¶àºÃ´¦£¬Èçʵʱ±àÒë¡¢ÀàÐÍ°²È«¡ ......

ʹÓÃc#´´½¨sql serverµÄ´æ´¢¹ý³Ì_c#Ó¦ÓÃ2

{
SqlConnection cnn = new SqlConnection
("context connection=true");
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "select * from customers";
SqlDataReader reader = cmd.ExecuteReader();
SqlContext.Pipe.Send(reader);
reader.Close();
cnn.Close();
}
......

¾ö²ßÊ÷C4.5Ëã·¨Java´úÂë

    - ¼ÓÈë²ËÄñѧϰÍø£¬»ñµÃÕä²Ø×ÊÔ´

Java´úÂë Êý¾ÝÍÚ¾òÖоö²ßÊ÷C4.5Ô¤²âË㷨ʵÏÖ(°ë³ÉÆ·£¬»¹ÒªÐ´¹æÔòºó¼ôÖ¦¼°¶Ô·ÇÀëÉ¢Êý¾ÝÐÅÏ¢ÔöÒæ¼ÆËã) Java´úÂë package org.struct.decisiontree;   import java.util.ArrayList;   import java.util.Arrays; ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ