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

PythonǶÈëC++

PythonǶÈëC++Ïê½â(1)--HelloWorld
À´CSDNµÄʱºò£¬¸Õ¸Õ½Ó´¥Python£¬ÄÇʱºò¶ÔPythonµÄǶÈ벿·ÖºÜ¸ÐÐËȤ£¬Ö»ÊÇһֱûÓÐʱ¼äÀ´ÅªÇåÆäÃæÉ´£¬Òò´ËҲһֱûÓÐʹÓÃǶÈëµÄ¹¦ÄÜ£¬ÁíÒ»¸öÔ­ÒòÊÇÎÒ»¹Ã»ÓÐÕæÕýÓÃPythonд¹ýÒ»¸öÕýʽµÄÓÐÓõãµÄ¶«Î÷£¬²»¹ý£¬ÏÖÔڻعýÍ·À´¼ÌÐø¿´ÕâÒ»²¿·Ö£¬·¢ÏÖ»¹ÊÇͦ¼òµ¥µÄ¡£ÒÔÇ°Ïë°ÑÕⲿ·Ö·­Òë³öÀ´£¬¿ÉÊÇÓÉÓÚʱ¼äÔ­Òò£¬Ò²Ã»ÓÐÄǾ«Á¦£¬ËùÒÔÕâÀïÎһὫÎÒËù̽¾¿µÄÿ¸öPython/CǶÈ벿·Öº¯Êý¶¼ÓÃʵÀýÀ´ËµÃ÷£¬ÎÒÏë¿´´úÂë±ÈÎÒ½âÊÍҪͨË×Ò׶®¡£
ÔÙ˵helloworld֮ǰ£¬ÏȲ»µÃ²»ÌáÏÂǶÈëµÄÅäÖÃÎÊÌâ¡£
²½Ö裺
1£ºÇëµ½¹ÙÍøÏÂÔØpythonµÄ°²×°³ÌÐò£¬°²×°python£¨ÎÒÏëÕâ²½Óеã¶àÓ࣬²»¹ý»¹ÊÇдÉÏ°É£©
2£º½Ó×ÅÄã¿ÉÄÜ»¹ÐèÒªÏÂÔØpython£¨Óë°²×°°æ±¾Ïàͬ£©Ô´´úÂ룬ÒòΪÎÒÃÇÐèÒªÔÚdebugϱàÒëÁ´½ÓÉú³É¶ÔÓ¦µÄdebug¿â£¬ÈôÄãÄÜÔÚÍøÉÏÕÒµ½±ðÈËÒѾ­±àÒëºÃµÄ¿â£¬ÄãÒ²¿ÉÒÔÖ±½ÓÓñðÈ˵ġ£ÕâÑùµÃµ½2¸ödebug°æ±¾µÄ.libºÍ.dll
3£º½«pythonĿ¼ÏµÄincludeÎļþ¼ÐϵÄÎļþÒƵ½±àÒëϵͳµÄincludeÖУ¬È»ºó½«releaseºÍdebug°æ±¾µÄ.libºÍ.dll·Åµ½Ö¸¶¨µÄÎļþ¼ÐÖУ¨lib·Åµ½±àÒëϵͳlib£¬dll·Åµ½windows/system32/£©
4£ººÃÁË£¬ÅäÖþʹËÍê³ÉÁË¡£
À´¿´´úÂ룺
#include "python/python.h"  //ÎÒÊǽ«pythonÄÇЩͷÎļþ·ÅÔÚÎÒ×Ô¼º½¨µÄÃûΪpythonµÄÎļþ¼ÐÖÐ
int main(int argc,char** argv)
{
 Py_Initialize();//¸Ãº¯ÊýÆô¶¯python½âÊÍÆ÷£¬ËãÊdzõʼ»¯
////////////////////////
//ÔØÈëÎļþµÄ·½Ê½ÔËÐÐÖ¸Áî,FILEÊÇC±ê×¼¿âstdio.hÎļþÖеÄÒ»¸ö½á¹¹£¬Ï°¹ßCÓïÑÔµÄÓ¦¸ÃºÜÊìϤ£¨²»¹ýÎÒ»¹ÊǵÚÒ»´ÎʹÓ㬺¹...£©
 FILE * fr;
 fopen_s(&fr,"test.txt","r");
 PyRun_SimpleFile(fr,"test.txt");
 fclose(fr);
//Ö±½ÓÔËÐÐÖ¸ÁָÁÊÇ×Ö·û´®£¬×¢Òâ3.1.1°æµÄpython±ØÐë¼ÓÉÏСÀ¨ºÅ
 PyRun_SimpleString("print('Hello world,I am python!')");
///////////////////////
 Py_Finalize();   //¸Ãº¯Êý¹Ø±Õpython½âÊÍÆ÷£¬ËãÊÇɨβ
 return 0;
}
//¸½´øtest.txt
/*
from time import time,ctime
print('Today is', ctime(time()))
*/
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/xiadasong007/archive/2009/09/02/4511841.aspx
 PythonǶÈëC++Ïê½â(2)--Import Module
Ê×ÏÈ£¬ÎÒ²»µÃ²»Ìáµ½Ò»¸ö·Ç³£ºÃµÄÍøÕ¾£ºhttp://www.codase.com/index.html
ÕâÊÇÎÒÔÚ²éÕÒǶÈ뺯Êýʱ·¢Ïֵģ¬ÀïÃæÓзdz


Ïà¹ØÎĵµ£º

(ת)C/C++ ºêÏê½â

ÖÚ¶àC++Êé¼®¶¼ÖÒ¸æÎÒÃÇCÓïÑÔºêÊÇÍò¶ñÖ®Ê×£¬µ«ÊÂÇé×ܲ»ÈçÎÒÃÇÏëÏóµÄÄÇô»µ£¬¾ÍÈçͬgotoÒ»Ñù¡£ºêÓÐ
Ò»¸öºÜ´óµÄ×÷Ó㬾ÍÊÇ×Ô¶¯ÎªÎÒÃDzúÉú´úÂë¡£Èç¹û˵ģ°å¿ÉÒÔΪÎÒÃDzúÉú¸÷ÖÖÐͱðµÄ´úÂë(ÐͱðÌæ»»)£¬
ÄÇôºêÆäʵ¿ÉÒÔΪÎÒÃÇÔÚ·ûºÅÉϲúÉúеĴúÂë(¼´·ûºÅÌæ»»¡¢Ôö¼Ó)¡£
¹ØÓÚºêµÄһЩÓï·¨ÎÊÌ⣬¿ÉÒÔÔÚgoogleÉÏÕÒµ½¡£ÏàÐÅÎÒ£¬Äã¶Ô ......

¼¸ÖÖ³öÉ«µÄC/C++ GUIº¯Êý¿âµÄ½éÉÜ

 
QT
http://www.trolltech.com
http://www.qiliang.net/qt.html
QtÊÇTrolltech¹«Ë¾µÄÒ»¸ö¶àƽ̨µÄC++ͼÐÎÓû§½çÃæÓ¦ÓóÌÐò¿ò¼Ü¡£ËüÌṩ¸øÓ¦ÓóÌÐò¿ª·¢Õß½¨Á¢ÒÕÊõ¼¶µÄͼÐÎÓû§½çÃæËùÐèµÄËùÓù¦ÄÜ¡£QtÊÇÍêÈ«ÃæÏò¶ÔÏóµÄºÜÈÝÒ×À©Õ¹£¬²¢ÇÒÔÊÐíÕæÕýµØ×é¼þ±à³Ì¡£×Ô´Ó1996ÄêÔçЩʱºò£¬Qt½øÈëÉÌÒµÁìÓò£¬ËüÒѾ­³ÉΪȫÊÀ½ç·¶ ......

C/C++±ÊÊÔÌâÄ¿´óÈ«

 1.ÇóÏÂÃ溯ÊýµÄ·µ»ØÖµ£¨Î¢Èí£©
¡¡¡¡int func(x)
¡¡¡¡{
¡¡¡¡int countx = 0;
¡¡¡¡while(x)
¡¡¡¡{
¡¡¡¡countx ++;
¡¡¡¡x = x&(x-1);
¡¡¡¡}
¡¡¡¡return countx;
¡¡¡¡}
¡¡¡¡¼Ù¶¨x = 9999¡£ ´ð°¸£º8
¡¡¡¡Ë¼Â·£º½«xת»¯Îª2½øÖÆ£¬¿´º¬ÓеÄ1µÄ¸öÊý¡£
¡¡¡¡2. ʲôÊÇ“ÒýÓÔ£¿ÉêÃ÷ºÍʹÓÓÒýÓ ......

ʹÓÃPythonÓïÑÔÉè¼Æ»ùÓÚHTMLµÄCÓïÑÔÓï·¨¼ÓÁÁÏÔʾ³ÌÐò

2005-2006ѧÄêµÚ1ѧÆÚ
±à Òë Ô­ Àí 
¿Î ³Ì Éè ¼Æ ±¨ ¸æ
°à¼¶   02¼Æ(¶þ)   
ѧºÅ     19     
ÐÕÃû     ÁõÏþÃ÷     
³É¼¨           
Ö¸µ¼½Ìʦ   ¬³¯»Ô   
Ò»¡¢   Éè¼ÆÄ¿µÄ
¼ÓÉî¶Ô±àÒ ......

C\C++Ìõ¼þ£¨ÈýÄ¿£©ÔËËã·ûÇÉÃîÔ­Àí½âÎö

     ×î½üÒ»Ö±Ñо¿Ò»¸ö¶Ô¸öÈ˶øÑÔºÜÓмÛÖµµÄÒ»¸öLIB¿âµÄÄæÏò¡£ÔÚ½ñÌìÏ°àºóͻȻÁé¸ÐÉÁÏÖ£¬Õâ¸ö¶Ï¶ÏÐøÐøÄæÁ˽ӽüÒ»ÖܵĺËÐĹÜÀíÀà¡£ÖÕÓÚÔÚ½ñÌì¸øÄæÍêÁË¡£ÔÚ×îºóÒ»¸öº¯ÊýÀÅöµ½ÁË֮ǰ»ù±¾Ã»ÓÐÓùýµÄÒ»ÌõÖ¸Áî¡££¨ºÇºÇ£¬¸ßÊÖ¼ûЦÁË£¡£©µ±È»¹â¿´µ¥¾äµÄ»ã±àÖ¸ÁÊÇûÓа취¿´³ö¾ßÌåµÄ×÷Óõģ¬¶øÇÒ»¹ºÜ¿ÉÄÜ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ