ǶÈëʽCÃæÊÔÌâ1
1 . ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365)UL
ÎÒÔÚÕâÏë¿´µ½¼¸¼þÊÂÇ飺
1) #define Óï·¨µÄ»ù±¾ÖªÊ¶£¨ÀýÈ磺²»ÄÜÒԷֺŽáÊø£¬À¨ºÅµÄʹÓ㬵ȵȣ©
2)¶®µÃÔ¤´¦ÀíÆ÷½«ÎªÄã¼ÆËã³£Êý±í´ïʽµÄÖµ£¬Òò´Ë£¬Ö±½Óд³öÄãÊÇÈçºÎ¼ÆËãÒ»ÄêÖÐÓжàÉÙÃë¶ø²»ÊǼÆËã³öʵ¼ÊµÄÖµ£¬ÊǸüÇåÎú¶øûÓдú¼ÛµÄ¡£
3) Òâʶµ½Õâ¸ö±í´ïʽ½«Ê¹Ò»¸ö16λ»úµÄÕûÐÍÊýÒç³ö-Òò´ËÒªÓõ½³¤ÕûÐÍ·ûºÅL,¸æËß±àÒëÆ÷Õâ¸ö³£ÊýÊǵij¤ÕûÐÍÊý¡£
4) Èç¹ûÄãÔÚÄãµÄ±í´ïʽÖÐÓõ½UL£¨±íʾÎÞ·ûºÅ³¤ÕûÐÍ£©£¬ÄÇôÄãÓÐÁËÒ»¸öºÃµÄÆðµã¡£¼Çס£¬µÚÒ»Ó¡ÏóºÜÖØÒª¡£
2 . дһ¸ö"±ê×¼"ºêMIN £¬Õâ¸öºêÊäÈëÁ½¸ö²ÎÊý²¢·µ»Ø½ÏСµÄÒ»¸ö¡£
#define MIN(A,B) £¨£¨A£© <= (B) ? (A) : (B))
Õâ¸ö²âÊÔÊÇΪÏÂÃæµÄÄ¿µÄ¶øÉèµÄ£º
1) ±êʶ#defineÔÚºêÖÐÓ¦ÓõĻù±¾ÖªÊ¶¡£ÕâÊǺÜÖØÒªµÄ¡£ÒòΪÔÚ Ç¶Èë(inline)²Ù×÷·û ±äΪ±ê×¼CµÄÒ»²¿·Ö֮ǰ£¬ºêÊÇ·½±ã²úÉúǶÈë´úÂëµÄΨһ·½·¨£¬¶ÔÓÚǶÈëʽϵͳÀ´Ëµ£¬ÎªÁËÄÜ´ïµ½ÒªÇóµÄÐÔÄÜ£¬Ç¶Èë´úÂë¾³£ÊDZØÐëµÄ·½·¨¡£
2)ÈýÖØÌõ¼þ²Ù×÷·ûµÄ֪ʶ¡£Õâ¸ö²Ù×÷·û´æÔÚCÓïÑÔÖеÄÔÒòÊÇËüʹµÃ±àÒëÆ÷ÄܲúÉú±Èif-then-else¸üÓÅ»¯µÄ´úÂ룬Á˽âÕâ¸öÓ÷¨ÊǺÜÖØÒªµÄ¡£
3) ¶®µÃÔÚºêÖÐСÐĵذѲÎÊýÓÃÀ¨ºÅÀ¨ÆðÀ´
4) ÎÒÒ²ÓÃÕâ¸öÎÊÌ⿪ʼÌÖÂÛºêµÄ¸±×÷Óã¬ÀýÈ磺µ±ÄãдÏÂÃæµÄ´úÂëʱ»á·¢ÉúʲôÊ£¿
least = MIN(*p++, b);
3. Ô¤´¦ÀíÆ÷±êʶ#errorµÄÄ¿µÄÊÇʲô£¿
Èç¹ûÄã²»ÖªµÀ´ð°¸£¬Çë¿´²Î¿¼ÎÄÏ×1¡£ÕâÎÊÌâ¶ÔÇø·ÖÒ»¸öÕý³£µÄ»ï¼ÆºÍÒ»¸öÊé´ô×ÓÊǺÜÓÐÓõġ£Ö»ÓÐÊé´ô×ӲŻá¶ÁCÓïÑԿα¾µÄ¸½Â¼È¥ÕÒ³öÏóÕâÖÖÎÊÌâµÄ´ð°¸¡£µ±È»Èç¹ûÄã²»ÊÇÔÚÕÒÒ»¸öÊé´ô×Ó£¬ÄÇôӦÊÔÕß×îºÃÏ£Íû×Ô¼º²»ÒªÖªµÀ´ð°¸¡£
ËÀÑ»·£¨Infinite loops£©
4. ǶÈëʽϵͳÖо³£ÒªÓõ½ÎÞÏÞÑ»·£¬ÄãÔõôÑùÓÃC±àдËÀÑ»·ÄØ£¿
Õâ¸öÎÊÌâÓü¸¸ö½â¾ö·½°¸¡£ÎÒÊ×Ñ¡µÄ·½°¸ÊÇ£º
while(1)
{
}
һЩ³ÌÐòÔ±¸üϲ»¶ÈçÏ·½°¸£º
for(;;)
{
}
Õâ¸öʵÏÖ·½Ê½ÈÃÎÒΪÄÑ£¬ÒòΪÕâ¸öÓ﷨ûÓÐÈ·Çбí´ïµ½µ×Ôõô»ØÊ¡£Èç¹ûÒ»¸öÓ¦ÊÔÕ߸ø³öÕâ¸ö×÷Ϊ·½°¸£¬ÎÒ½«ÓÃÕâ¸ö×÷Ϊһ¸ö»ú»áȥ̽¾¿ËûÃÇÕâÑù×öµÄ»ù±¾ÔÀí¡£Èç¹ûËûÃǵĻù±¾´ð°¸ÊÇ£º"ÎÒ±»½Ì×ÅÕâÑù×ö£¬µ«´ÓûÓÐÏëµ½¹ýΪʲô¡£"Õâ»á¸øÎÒÁôÏÂÒ»¸ö»µÓ¡Ïó¡£
µÚÈý¸ö·½°¸ÊÇÓà goto
L
Ïà¹ØÎĵµ£º
ÉèÖãº
1. Tools/Projects and Solutions/VC ++ Directories
Inlcude files: C:\Program Files\MATLAB\R2009a\extern\include
Library files: C:\Program Files\MATLAB\R2009a\extern\lib
2. Property
Configuration Properties/Linker
......
¹þ¹þ£¡ÓÐÐÒÔÚijÍøÕ¾·¢ÏÖÕâƪÎÄÕ£¬¶Á°Õ£¬¾õµÃÂùÓеÀÀí£¬·¢À´´ó¼ÒÒ»Æð¹²ÃãÖ®
×ÜÊDZ»Í¬Ñ§ÃÇÎʵ½£¬ÈçºÎѧϰCºÍC++²Å²»Ã£È»£¬²Å²»ÊÇÂÒѧ£¬ÏëÁËһϣ¬ÕâÀï¸ø³öÒ»¸ö×ܵĻظ´¡£
' J$ |0 ?! p% w" t5 D6 D: c9 |0 B
¡¡¡¡Ò»¼ÒÖ®ÑÔ£¬»¶ÓÅÄש¹þ¡£
¡¡¡¡1¡¢¿ÉÒÔ¿¼ÂÇÏÈѧϰC.
/ U$ X+ X/ P; Y ......
1.ÇóÏÂÃ溯ÊýµÄ·µ»ØÖµ£¨ ΢Èí£©
int func(x)
{
int countx = 0;
while(x)
{
countx ++;
x = x&(x-1);
  ......
Õâ¶ÎÔ´ÂëÄÜÔÚlinuxÏÂÔËÐУ¡£¡£¡ ÄÜʶ±ðСÊý
#include<unistd.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
/*#define NULL 0*/
/* ×Ô¶¨Òå±äÁ¿ */
#define&n ......
CÓïÑÔ£¬ÓÐʱºòÕæ²»µÃ²»ÅåËü£¬ÕÕÀí˵£¬Îļþ´¦Àíº¯ÊýÊÇûÓÐʲôºÃ½²µÄ£¬µ«¶ÔÓںܶàCÈëÃŵÄÈËÀ´Ëµ£¬ËƺõÒ²ÊÇÖµµÃ¾²ÐÄƷζһ·¬µÄ¡£
CÖеÄÎļþ´¦Àíº¯Êý²¢²»ºÜ¶à£¬¶ø³£Óõģ¬Ëƺõ¸üÉÙ¡£
º¯Êý²»ÄÑ£¬µ«²¢²»´ú±íÎļþ´¦ÀíÒ²²»ÄÑ¡£ËƺõÓÖÒªÓеãÅÜÌâÁË£¬ÎÒ×ÜÊÇϲ»¶ÅÜÌâ¡£Éϼ¸Ìì×öÃΣ¬Ãε½ÎÒµôµ½ÔÂÇòÉÏÈ¥À²……
¶ÔÎļþµ ......