¾µäC/C++ÃæÊÔÌ⣨¶þ£©
char str1[] = "abc";
char str2[] = "abc";
const char str3[] = "abc";
const char str4[] = "abc";
const char* str5 = "abc";
const char* str6 = "abc";
cout << boolalpha << ( str1==str2 ) << endl; // Êä³öʲô£¿
cout << boolalpha << ( str3==str4 ) << endl; // Êä³öʲô£¿
cout << boolalpha << ( str5==str6 ) << endl; // Êä³öʲô£¿
2. ·ÇC++ÄÚ½¨Ðͱð A ºÍ B£¬ÔÚÄļ¸ÖÖÇé¿öÏÂBÄÜÒþʽת»¯ÎªA£¿[C++ÖеÈ]
´ð£º
a. class B : public A { ……} // B¹«Óм̳Ð×ÔA£¬¿ÉÒÔÊǼä½Ó¼Ì³ÐµÄ
b. class B { operator A( ); } // BʵÏÖÁËÒþʽת»¯ÎªAµÄת»¯
c. class A { A( const B& ); } // AʵÏÖÁËnon-explicitµÄ²ÎÊýΪB£¨¿ÉÒÔÓÐÆäËû´øĬÈÏÖµµÄ²ÎÊý£©¹¹Ô캯Êý
d. A& operator= ( const A& ); // ¸³Öµ²Ù×÷£¬Ëä²»ÊÇÕý×ÚµÄÒþʽÀàÐÍת»»£¬µ«Ò²¿ÉÒÔÃãÇ¿ËãÒ»¸ö
3. ÒÔÏ´úÂëÖеÄÁ½¸ösizeofÓ÷¨ÓÐÎÊÌâÂð£¿[CÒ×]
void UpperCase( char str[] ) // ½« str ÖеÄСд×Öĸת»»³É´óд×Öĸ
{
for( size_t i=0; i<sizeof(str)/sizeof(str[0]); ++i )
if( 'a'<=str[i] && str[i]<='z' )
str[i] -= ('a'-'A' );
}
char str[] = "aBcDe";
cout << "str×Ö·û³¤¶ÈΪ: " << sizeof(str)/sizeof(str[0]) << endl;
UpperCase( str );
cout << str << endl;
int func(x)
{
int countx = 0;
while(x)
{
countx ++;
x = x&(x-1);
}
return countx;
}
¼Ù¶¨x =&n
Ïà¹ØÎĵµ£º
ÔÚ´ò°üoralce¿Í»§¶Ëºó£¬¾³£»áÓöµ½Õâ¸öÎÊÌâ“specified class not registered in registry”
½â¾ö°ì·¨£º
ÕâÊÇÒòΪÓм¸¸öÁ´½Ó¿âdll»òocxûע²áµÄÔÒò£¬¾±¾È˲âÊÔΪÒÔÏÂ5¸öÎļþ£º
......
Êý×Öת×Ö·û´®£º
ÓÃC++µÄstreanstream:
#include <sstream>
#Include <string>
string num2str(double i)
...{
stringstream ss;
ss<<i;
return ss.str();
......
ÔÚÌÖÂÛÈ«¾Ö±äÁ¿Ö®Ç°ÎÒÃÇÏÈÒªÃ÷°×¼¸¸ö»ù±¾µÄ¸ÅÄ
1. ±àÒëµ¥Ôª(Ä£¿é)£º
ÔÚIDE¿ª·¢¹¤¾ß´óÐÐÆäµÀµÄ½ñÌ죬¶ÔÓÚ±àÒëµÄһЩ¸ÅÄîºÜ¶àÈËÒѾ²»ÔÙÇå³þÁË£¬ºÜ¶à³ÌÐòÔ±×îŵľÍÊÇ´¦ÀíÁ¬½Ó´íÎó(LINK ERROR), ÒòΪËü²»Ïñ±àÒë´íÎóÄÇÑù¿ÉÒÔ¸ø³öÄã³ÌÐò´íÎóµÄ¾ßÌåλÖã¬Äã³£³£¶ÔÕâÖÖ´íÎó¸Ðµ½°ÃÄÕ£¬µ«ÊÇÈç¹ûÄ ......
C/C++ÖеÄÈÕÆÚºÍʱ¼ä
ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ ......
£¨±¾ÎÄÊÕ¼¯ÖÁÍøÂ磩
1.½éÉÜÒ»ÏÂSTL£¬Ïêϸ˵Ã÷STLÈçºÎʵÏÖvector¡£
STL (±ê׼ģ°æ¿â£¬Standard Template Library)ËüÓÉÈÝÆ÷Ëã·¨µü´úÆ÷×é³É¡£
STLÓÐÒÔϵÄһЩÓŵ㣺
¿ÉÒÔ·½±ãÈÝÒ×µØʵÏÖËÑË÷Êý¾Ý»ò¶ÔÊý¾ÝÅÅÐòµ ......