CºêµÄÓ÷¨
Ç°¼¸Ìì²Î¼Óij¹«Ë¾µÄ±ÊÊÔ£¬ÓÐÒ»µÀÌâÊÇÓô¿CʵÏÖÒ»¸ö·ºÐͺ¯Êý¡£ÓôÃÆÁ˺þÃÓÃC++Ä£°åʵÏÖÁË¡£
ºêÓÐÈçϵÄÌص㣺
1.ÓëconstÏà±È£¬ºêÊÇÔÚÔ¤±àÒëµÄʱºòÍê³ÉµÄ
2.define Ö»×ö¼òµ¥µÄÌæ»»£¬²»×öÀàÐÍ°²È«¼ì²é
3.ʹÓò»µ±»áÒýÆðºÜ¶àÎÊÌâ
ºêµÄÓ÷¨£º
1.¼òµ¥µÄºê¶¨Òå
#define MAX 1024
2.ºê¶¨Ò幦ÄÜ¿é
#define MAX(a,b) (a)>(b)?(a):(b) //±È½Ï´óСµÄºê
3¶¨Ò庯ÊýʵÏÖ·ºÐÍ
#define SORT(Type) void Buble_sort(Type a[],int len) { \
bool is_swap=true;\
for(int i=0;i<len&&is_swap;++i)\
{\
is_swap = false;\
for(int j=0;j<len-i;++j)\
{\
if(a[j]>a[j+1])\
{\
Type t;\
t=a[j];\
a[j+1] = a[j];\
a[j]=t;\
is_swap = true;\
}\
}\
}\
}
SORT(int);
SORT(double);
SORT(float);
SORT(unsigned int);
4.¶¨ÒåÀà
#define _DECL_class(name, element )\
class df_##nm\
{\
protected:\
element *pData;\
int num;\
\
void _resize(int n);\
\
public:\
nm( ){};\
\
int Count() const { return num; }\
\};
_DECL_class( cls_example, int );
Ïà¹ØÎĵµ£º
ÈÃÎÒÃÇ´ÓÒ»¸ö·Ç³£¼òµ¥µÄÀý×Ó¿ªÊ¼£¬ÈçÏ£º
int n;
Õâ¸öÓ¦¸Ã±»Àí½âΪ“declare n as an int”£¨nÊÇÒ»¸öintÐ͵ıäÁ¿£©¡£
½ÓÏÂÈ¥À´¿´Ò»ÏÂÖ¸Õë±äÁ¿£¬ÈçÏ£º
int *p;
Õâ
¸öÓ¦¸Ã±»Àí½âΪ“declare p as an int *”£¨pÊÇÒ»¸öint
*Ð͵ıäÁ¿£©£¬»òÕß˵pÊÇÒ»¸öÖ¸ÏòÒ»¸öintÐͱäÁ¿µÄÖ¸Õë¡£ÎÒÏëÔÚÕ ......
¸ñʽ: echo "\033[×Ö±³¾°ÑÕÉ«;×ÖÌåÑÕÉ«m×Ö·û´®\033[0m"
ÀýÈç:
echo "\033[41;36m something here \033[0m"
ÆäÖÐ41µÄλÖôú±íµ×É«, 36µÄλÖÃÊÇ´ú±í×ÖµÄÑÕÉ«
ÄÇЩascii code ÊǶÔÑÕÉ«µ÷ÓõÄʼĩ.
\033[ ; m …… \033[0m
×Ö±³¾°ÑÕÉ«·¶Î§:40----49
40:ºÚ
41:Éîºì
42:ÂÌ
43:»ÆÉ«
44:À¶É«
45:×ÏÉ«
4 ......
Linux
ÏÂ
C
¿ª·¢——
gcc
£¬
gdb
µÄʹÓÃ
×÷Õߣº
zccst
ÎÒÃÇѧϰµÄ¹ý³ÌÓ¦¸ÃÊÇÒ»¸ö»ýÀ۵Ĺý³Ì£¬ÓÐÎÞµ½ÓУ¬ÓÖÉÙµ½¶à£¬¶ø²»ÄÜÏñÏÂɽµÄºï×Ó¡£
9
Ô·ݵÄʱºòÊǵÚÒ»´Îϵͳѧϰ
gcc, gdb, makefile
£¨Ïê¼ûÇ°Ã沩¿Í£©¡£Èç½ñ×÷ΪǶÈëʽϵͳµÄÒ»¸ö×é³É²¿·Ö£¬¾ö¶¨ÖØѧһ´Î£¬¸Ð¾õÀí½â¼ÓÉîÁËһЩ¡£
gcc
......
CÓïÑԺ궨ÒåʵÓÃ×ܽá
ºê¶¨ÒåÁËÒ»¸ö´ú±íÌض¨ÄÚÈݵıêʶ·û¡£
Ô¤´¦Àí¹ý³Ì»á°ÑÔ´´úÂëÖгöÏֵĺê±êʶ·ûÌæ»»³Éºê¶¨ÒåʱµÄÖµ¡£
ºê×î³£¼ûµÄÓ÷¨ÊǶ¨Òå´ú±íij¸öÖµµÄÈ«¾Ö·ûºÅ¡£
ºêµÄµÚ¶þÖÖÓ÷¨ÊǶ¨Òå´ø²ÎÊýµÄºê£¬ÕâÑùµÄºê¿ÉÒÔÏóº¯ÊýÒ»Ñù±»µ÷Ó㬵«ËüÊÇÔÚµ÷ÓÃÓï¾ä´¦Õ¹¿ªºê£¬²¢Óõ÷ÓÃʱµÄʵ¼Ê²ÎÊýÀ ......