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

Ò»¸öC++µ÷ÓÃCµÄÀý×Ó

//cExample.h
#ifndef C_EXAMPLE_H
#define C_EXAMPLE_H
#ifdef __cplusplus
extern "C"
{
#endif
int add(int x, int y);
#ifdef __cplusplus
}
#endif
#endif
---------------------------------
//cExample.c
#include"cExample.h"
int add(int x, int y)
{
 return x + y;
}
---------------------------------
//cppFile.cpp
#include <iostream>
#include"cExample.h"
using namespace std;
main()
{
    cout<<add(2,3)<<endl;
    return 0;
}
--------------------------------
//makefile
cppFile: cppFile.o cExample.o
    g++ -g -o cppFile cppFile.o cExample.o
cppFile.o: cppFile.cpp
    g++ -g -c cppFile.cpp
cExample.o: cExample.c cExample.h
    gcc -g -c cExample.c
clean:
    rm -f *.o cppFile


Ïà¹ØÎĵµ£º

ת£ºLinuxϽøÐÐMYSQLµÄC++±à³ÌÆð²½ÊÖ¼Ç


LinuxϽøÐÐMYSQLµÄC++±à³ÌÆð²½ÊÖ¼Ç
Ê×ÏȰ²×°±ØÐèµÄ¿ª·¢°ü
sudo apt-get install gcc g++ libgcc1 libg++ make gdb
°²×°MYSQLµÄCÓïÑÔ¿ª·¢°ü
sudo apt-get install libmysql++-dev libmysql++2c2a libmysqlclient15-dev libmysqlclient15off
......

linux»·¾³±àÒëc++¶¯Ì¬¿âÒÔ¼°µ÷Ó÷½Ê½

ÉÏÒ»´ÎÓÃlinuxÊÇ2002ÄêÓÃkdevelop¼°qt¿â¿ª·¢¶àýÌåÈí¼þ¡£
ʱ¸ô8ÄêÔÙÒ»´ÎÔÚlinuxϸ㿪·¢£¬ÒÀÈ»²ËÄñ£¬»¹ÊÇÉúÊè¡£
¸Ð¾õ×Ô¼ºµÄ´óÄԵĴ洢¿Õ¼ä£¬Ëæ×ÅÄêÁäµÄÔö¼ÓÔÚ±äС£¬ºÜ¶àŪ¹ýµÄ£¬ÓÖÖ»ÄÜ´ÓͷѧÆð¡£
²»¹ýÓо仰“»îµ½ÀÏ£¬Ñ§µ½ÀÏ”¹þ£¡
²ÑÀ¢£¬²ÑÀ¢¡£
1¡¢±àд¶¯Ì¬¿âµÄc++Îļþ
    cvpnlib.cpp cv ......

ʹÓÃNDK¿ª·¢C/C++ÏîÄ¿¹æÔò(ZT)

ʹÓÃNDK¿ª·¢C/C++ÏîÄ¿¹æÔò
<!-- /* Font Definitions */ @font-face {font-family:ËÎÌå; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;}@font-face {font-family:"\@ËÎÌå&qu ......

C/SÓëB/S

C/S¼Ü¹¹µÄÓŵãÈçÏ£º
£¨1£©C/S¼Ü¹¹µÄ½çÃæºÍ²Ù×÷ÊÖÊÆ¿ÉÒÔËæ×ſͻ§µÄÒªÇó½øÐж¨ÖÆ£¬¿ÉÒÔʵÏֵķdz£Æ¯ÁÁ£¬ÓÉÓÚÅÖ¿Í»§¶Ë½¨Á¢ÔÚÓ¦ÓõĻù´¡ÉÏ£¬Òò´Ë²»»áÓÉÓÚÆ¯ÁÁµÄ½çÃæ¶øÓ°Ïìʵ¼ÊµÄ²Ù×÷¡£
£¨2£©ÏµÍ³°²È«ÐÔÄÜ¿ÉÒԵõ½ºÜºÃµÄ±£Ö¤£¬ÊµÏÖ¶à²ãÈÏÖ¤Ò²²»À§ÄÑ¡£
£¨3£©C/S½á¹¹µÄϵͳÓÉÓÚÖ»ÓÐÒ»²ã½»»¥£¬Òò´ËÏìÓ¦Ëٶȷdz£¿ì¡£
C/S¹¹¼ÜµÄÈ ......

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. ʲôÊÇ“ÒýÓÔ£¿ÉêÃ÷ºÍʹÓÓÒýÓÔҪעÒâÄÄЩÎÊÌ⣿
´ð£ºÒýÓþÍÊÇij¸öÄ¿±ê±äÁ¿µÄ&l ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ