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

C++ÖеÄλ¿½±´ºÍÖµ¿½±´

ΪÁ˱ãÓÚ˵Ã÷ÎÒÃÇÒÔStringÀàΪÀý£º
Ê×Ïȶ¨ÒåStringÀ࣬¶ø²¢²»ÊµÏÖÆä³ÉÔ±º¯Êý¡£
Class String{
public:
    String(const char *ch=NULL);//ĬÈϹ¹Ô캯Êý
    String(const String &str);//¿½±´¹¹Ô캯Êý
   ~String(void);
   String &operator=(const String &str);//¸³Öµº¯Êý
private:
   char *m_data;
};
λ¿½±´¿½±´µÄÊǵØÖ·£¬¶øÖµ¿½±´Ôò¿½±´µÄÊÇÄÚÈÝ¡£Èç¹û¶¨ÒåÁ½¸öString¶ÔÏóAºÍB¡£A.m_dataºÍB.m_data·Ö±ðÖ¸ÏòÒ»¶ÎÇøÓò£¬A.m_data="windows",B.m_data=“linux";
Èç¹ûδÖØд¸³Öµº¯Êý£¬½«B¸³¸øA;Ôò±àÒëÆ÷»áĬÈϽøÐÐλ¿½±´£¬A.m_data=B.m_data
ÔòA.m_dataºÍB.m_dataÖ¸Ïòͬһ¿éÇøÓò£¬ËäÈ»A.m_dataÖ¸ÏòµÄÄÚÈÝ»á¸Ä±ä³É"linux",µ«ÊÇÕâÑùÈÝÒ׳öÏÖÕâЩÎÊÌ⣺
(1):A.m_dataÔ­À´Ö¸ÏòµÄÄÚ´æÇøÓòδÊÍ·Å£¬Ôì³ÉÄÚ´æй¶¡£
(2):A.m_dataºÍB.m_dataÖ¸Ïòͬһ¿éÇøÓò£¬ÈκÎÒ»·½¸Ä±ä¶¼»áÓ°ÏìÁíÒ»·½
 (3)£ºµ±¶ÔÏó±»Îö¹¹Ê±£¬B.m_data±»ÊÍ·ÅÁ½´Î¡£
¶ÔÓÚ±àÒëÆ÷£¬Èç¹û²»Ö÷¶¯±àд¿½±´º¯ÊýºÍ¸³Öµº¯Êý£¬Ëü»áÒԓλ¿½±´”µÄ·½Ê½×Ô¶¯Éú³ÉȱʡµÄº¯Êý¡£
Èç¹ûÖØд¸³Öµº¯ÊýºÍ¿½±´¹¹Ô캯Êýºó£¬
A.m_data=B.m_data£¬½øÐеÄÊÇÖµ¿½±´£¬»á½«B.m_dataµÄÄÚÈݸ³¸øA.m_data,A.m_data»¹ÊÇÖ¸ÏòÔ­À´µÄÄÚ´æÇøÓò£¬µ«ÊÇÆäÄÚÈݸı䡣
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/liam1122/archive/2007/12/25/1966617.aspx


Ïà¹ØÎĵµ£º

ÈçºÎÔÚLinuxʹÓÃEclipse + CDT¿ª·¢C/C++³ÌÐò?

A. ΪʲôҪÔÚLinuxʹÓÃEclipse¿ª·¢C/C++³ÌÐò?
LinuxÊÇÒ»¸öÒÔC/C++¿ª·¢ÎªÖ÷µÄƽ̨£¬ÎÞÂÛÊÇKernel»òÊÇApplication£¬Ö÷Òª¶¼Ê¹ÓÃC/C++¿ª·¢¡£´«Í³ÔÚLinuxÏ¿ª·¢³ÌÐò£¬ÊÇÔÚÎÄ×ÖģʽÏ£¬ÀûÓÃviµÈÎÄ×ֱ༭Æ÷׫дC/C++³ÌÐò´æÅ̺ó£¬ÔÚCommand lineÏÂʹÓÃgcc±àÒ룬ÈôÒªdebug£¬ÔòʹÓÃgdb¡£
ÕâÖÖ¿ª·¢·½Ê½Éú²úÁ¦²¢²»¸ß£¬ÈôÖ»ÊÇ¿ª·¢Ñ§ ......

CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС

CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС(
    C/C++µÄд·¨ÊDz»¿ÆѧºÍ²»ÑϽ÷µÄ¡£ÒòΪCºÍC++ËäÈ»ÓïÒ壬µ«ÊÇÉè¼Æ˼ÏëÊǽṹ»¯ÓëÃæÏò¶ÔÏó. C±ê×¼¹æ·¶ÓëC++µÄ±ê×¼¹æ·¶Ò²ÊÇÁ½¸öÎı¾¡£½üÀ´×ÐϸÑо¿ÁËËüÃǵÄÊý¾ÝÀàÐÍ£¬²ÅÖªµÀÆäÀ´ÁúÈ¥Âö£¬ÕæÕý×öµ½ÆäʵËùÒÔÈ»¡£
1¡¢CÓïÑÔ¶¨ÒåÁË5ÖÖ»ù±¾Êý¾ÝÀàÐÍ
  char(×Ö·û), int(Õ ......

C/C++º¯Êý²ÎÊý,´«ÖµÓò´«Ö·!!!

/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
void swap(int x, int y) {
cout << "x and y swap before : " << x << "\t" << y << endl;
int i = x;
x = y;
y = i; ......

LinuxÏÂC++¿ª·¢¹¤¾ß½éÉÜ

LinuxÏÂC++¿ª·¢¹¤¾ß½éÉÜ
 
 
¡¡¡¡¸ÅÊö
¡¡¡¡¾ÍC£«£«¿ª·¢¹¤¾ß¶øÑÔ£¬ÓëWindowsÏÂ΢Èí£¨VC£¬ VS2005µÈ£©Ò»Í³ÌìÏÂÏà±È£¬Linux/UnixÏÂC£«£«¿ª·¢£¬¿ÉνÎ廨°ËÃÅ£¬¸÷ʽ¸÷Ñù¡£Emacs, vi, eclipse, anjuta£¬kdevelopµÈ²ã³ö²»Çî¡£
¡¡¡¡WindowsÏ£¬¿ª·¢¹¤¾ß¶àÒÔ¼¯³É¿ª·¢»·¾³IDEµÄÐÎʽչÏÖ¸ø×îÖÕÓû§¡£ÀýÈ磬VS2005¼¯³ ......

C/C++Í·ÎļþÒ»ÀÀ


C/C++
Í·ÎļþÒ»ÀÀ

//////////////////////////////////////////////////////////////////////////
C
Í·Îļþ
(C89,C95)
(C++98,C++03Ò²°üº¬)
include <assert.h>¡¡¡¡¡¡¡¡//Õï¶Ï¿â
include <ctype.h>¡¡¡¡¡¡¡¡ //×Ö·û´¦Àíº¯Êý¿â
include <errno.h>¡¡¡¡¡¡¡¡ //´íÎó¶¨Òå
include <float.h& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ