CÓëC++·ç¸ñ×Ö·û´®
C·ç¸ñ×Ö·û´®£º¶Ô×Ö·û´®½øÐвÙ×÷µÄ C º¯Êý¶¨ÒåÔÚÍ·Îļþ<cstring>ÖУ»
1. ×Ö·û´®¶¨Ò壺char* result£»
2. ×Ö·û´®µÄ×îºóÒ»¸ö×Ö·ûÊÇnull×Ö·û£¨'\0'£©£¬¿ÉÒÔͨ¹ýÕâ¸ö×Ö·ûÈ·¶¨×Ö·û´®µÄ½áβ¡£
3. strlen()·µ»ØµÄÊÇ×Ö·û´®µÄ´óС£»Òò´Ë£¬·ÖÅä¿Õ¼äµÄʱºò£¬ÐèÒª±È×Ö·û´®µÄʵ¼Ê¿Õ¼ä´ó1.
e.g. char* copyString(const char* inString)
{
char *result = new char[strlen(inString)];//BUG£¡ off by one
strcpy(result, inString);
return result;
}
explain£º strlen£¨£©·µ»ØµÄÊÇ×Ö·û´®µÄ´óС£¬±ÈÈç"ab"£¬·µ»ØµÄÊÇ2¡£¶øÔÚnew½øÐзÖÅäµÄʱºò£¬ÐèҪΪ'\0'·ÖÅäÒ»¸ö¿Õ¼ä¡£·ÖÅäÓï¾äҪд×÷£¬char *result = new char[strlen(inString) + 1];
4. strcpy(a,b)£º½«×Ö·û´®bµÄÄÚÈݸ³Öµ¸ø×Ö·û´®a£»aµÄ´óС¿ÉÒÔ´óÓÚb£¬½«b·ÅÔÚaµÄ¿ªÊ¼µÄλÖã»
strcat(a£¬b)£º½«×Ö·û´®bÆ´½Óµ½×Ö·û´®aµÄÏÖÓÐ×Ö·ûºóÃ棻
C++·ç¸ñ×Ö·û´®£ºÊ¹ÓÃC++·ç¸ñ×Ö·û´®µÄʱºò£¬Òª½«Ëüµ±×öÊÇÒ»¸öÆÕͨµÄÀàÐÍ£¬Èçint£¬ÕâÑù·´¶ø»á±ÜÃ⽫string×÷Ϊһ¸öÀàÀ´Àí½âËù´øÀ´µÄºÜ¶àÎÊÌâ¡£
1. Ö§³Ö<cstring>ÖÐÐí¶àº¯ÊýÍê³ÉµÄͬÑù²Ù×÷¡£
2. ×Ö·û´®¶¨Ò壺string myString = “hello”£»
3. ²Ù×÷·û = £º¸´ÖÆ×Ö·û´®£»±ÈÈ磬string newone = original£»»á½«ºóÕ߸´ÖƸøÇ°Õߣ¬²»»á³öÏÖÁ½¸ö±äÁ¿Í¬ÑùÖ¸ÏòÒ»¸öÄÚ´æµÄÇé¿ö¡£
4. ¿ÉÒÔÏñintÒ»ÑùʹÓà == Ö®ÀàµÄ²Ù×÷·û
5. ¿ÉÒԸıä×Ö·û´®ÖеÄijһ¸ö×Ö·û¡£ Èç string myString = "hello"; mystring[0] = 'l'; ÕâÖвÙ×÷ÊÇÔÊÐíµÄ¡£
×Ö·û´®Ö±½ÓÁ¿£º×Ö·û´®Ã»ÓбäÁ¿Ãû×Ö£¬×ÔÉí±íʾ×ÔÉí¡£
1. string literal£º×Ö·û´®Ö±½ÓÁ¿£º
Ïà¹ØÎĵµ£º
Ôø¾Åöµ½¹ýÈÃÄãÃԻ󲻽⡢ÀàËÆÓÚint * (* (*fp1) (int) ) [10];ÕâÑùµÄ±äÁ¿ÉùÃ÷Â𣿱¾ÎĽ«ÓÉÒ×µ½ÄÑ£¬Ò»²½Ò»²½½Ì»áÄãÈçºÎÀí½âÕâÖÖ¸´ÔÓµÄC/C++ÉùÃ÷¡£
¡¡¡¡ÎÒÃǽ«´ÓÿÌ춼ÄÜÅöµ½µÄ½Ï¼òµ¥µÄÉùÃ÷ÈëÊÖ£¬È»ºóÖð²½¼ÓÈëconstÐÞÊηûºÍtypedef£¬»¹Óк¯ÊýÖ¸Õ룬×îºó½éÉÜÒ»¸öÄܹ»ÈÃÄã׼ȷµØÀí½âÈκÎC/C++ÉùÃ÷µÄ&ld ......
ACE×ÔÊÊÅäͨÐÅ»·¾³£¨ADAPTIVE Communication Environment£©ÊÇ¿ÉÒÔ×ÔÓÉʹÓᢿª·ÅÔ´ÂëµÄÃæÏò¶ÔÏó£¨OO£©¿ò¼Ü£¨Framework£©£¬ÔÚÆäÖÐʵÏÖÁËÐí¶àÓÃÓÚ²¢·¢Í¨ÐÅÈí¼þµÄºËÐÄģʽ¡£ACEÌṩÁËÒ»×é·á¸»µÄ¿É¸´ÓÃC++ Wrapper Facade£¨°ü×°Íâ¹Û£©ºÍ¿ò¼Ü×é¼þ£¬¿É¿çÔ½¶àÖÖƽ̨Íê³ÉͨÓõÄͨÐÅÈí¼þÈÎÎñ£¬ÆäÖаüÀ¨£ºÊ¼þ¶à··ÖÀëºÍʼþ´¦À ......
//ÊäÈëÒ»¸öÊý×飬ÔÙÐÞ¸ÄÕâ¸öÊý×éËùÓÐÔªËØ£¬ÈçºÎʵÏÖ£¿
int main()
{
vector<int> a;
int i(0);
while(cin>>i)
a.push_back(i);
//////////////////////////////////////////////////////Êä³ö½¨Á¢µÄÊý×飺
cout << "µÃµ½µÄÊý×éΪ£º" << ......
CÊÇÃæÏò¹ý³ÌµÄ³ÌÐòÉè¼Æ£¬³ÌÐò=Êý¾Ý½á¹¹+Ëã·¨ [×îÔʼ£¬µ«±à¸ö³Ìȷʵ²»Ò×]
C++ÊÇÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼Æ£¬³ÌÐò=¶à¸öÀà+ÏûÏ¢(Àà=Êý¾Ý½á+Ëã·¨)[±È½ÏÈÝÒ×ÉÏÊÖ]
C# ÊÇ´¿ÃæÏò¶ÔÏóµÄÓïÑÔ[¸ü¼Ó±È½ÏÈÝÒ×ÉÏÊÖ]
VC/VC++/VC# Ö»ÊÇÓÃÀ´¿ª·¢C/C++/C#Ó¦ÓóÌÐòµÄÈí¼þÖеÄÒ»ÖÖ¡£
......
Data Type Ranges
C/C++ recognizes the types shown in the table below.
Type Name Bytes Other Names Range of Values
&nb ......