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

¡¶the c programming language¡·»Ø¹ËÖ®Ò»

1,³ÌÐò¿ØÖÆÖеĿØÖÆÁ÷Óï¾äÓÃÓÚ¿ØÖƸ÷¼ÆËã»ú²Ù×÷Ö´ÐеĴÎÐò¡£
 Ê²Ã´ÊÇ¿ØÖÆÁ÷Óï¾äÏëÁË°ëÌ죬ԭÀ´²»¹ýÊÇÕâЩ£¬if-elseÓï¾ä£¬else-ifÓï¾ä£¬switchÓï¾ä£¬whileÑ­»·£¬forÑ­»·£¬do-whileÑ­»·µÈ¡£
2,»¨À¨ºÅ{}£¬ÆäÖеÄÓÒ»¨À¨ºÅÓÃÓÚ½áÊø³ÌÐò¿é£¬Æäºó²»ÐèÒª·ÖºÅ¡£
  µ±³õÒ»¿´µ½“Æäºó²»ÐèÒª·ÖºÅµÄ”ʱºòÏëÁË°ëÌ죬Ôõô²»ÐèÒª·ÖºÅÄØ£¿Ô­À´ÊÇÒòΪ£ºÄã¿´°¡£¬if(i=0;i<10;i++)ËüµÄºóÃæ¾ÍÊDz»ÐèÒª·ÖºÅµÄ£¬ËùÒÔ£¬Ïë¿´¶®ÀíÂÛ»¹ÊÇÒªÁªÏµÊµ¼ÊµÄ¡£
3,ÓÉÓÚifÓï¾äÖ»ÊǼòµ¥²âÊÔ±í´ïʽÊýÖµ£¬Òò´Ë £¬¿ÉÒÔ¶ÔijЩ´úÂëµÄ±àд½øÐмò»¯¡£
  ¿´µ½Õâ¾ä»°Ê±£¬Á¢¼´¾Í¸Ð¾õµ½£¬if()Óï¾ä»¹ÊÇͦÓÐÓõģ¬¿ÉÊÇÔõô¼ò»¯ÄØ£¬Ô­À´Ò²²»¹ýÊÇÕâÑù£ºif(i!=1).
4£¬³ÌÐòµÄËõ½ø½á¹¹Ã÷È·µØ±íÃ÷ÁËÉè¼ÆÒâͼ£¬µ«±àÒëÆ÷ÎÞ·¨»ñµÃÕâÒ»ÐÅÏ¢¡£
   Ïëµ½£º´úÂëµÄ¼ò»¯²¢²»´ú±í³ÌÐòµÄ¼ò»¯£¬´úÂë¼ò»¯ÁË£¬Ð§Âʲ»Ò»¶¨¸ß¡£»¹ÓÐдµÄ³ÌÐòÈË¿´µÃºÜÃ÷°×£¬µ«ÊǼÆËã»ú¿´µÃ²»Ò»¶¨Ã÷°×£¬ËùÒÔд³ÌÐòµÄʱºò£¬Ò»¶¨ÒªÒÔ¼ÆËã»úµÄ˼άÀ´Ð´£¬¶ø²»ÊÇÈ˵Ä˼ά¡£
5.if(±í´ïʽ£©
    Óï¾ä
  else if(±í´ïʽ£©
    Óï¾ä
  else if(±í´ïʽ£©
    Óï¾ä
  else
     Óï¾ä
 Õâô³¤µÄ±í´ï£¬ÄãÏë¹ý×îºóµÄelse¿ÉÒÔÊ¡ÂÔÂð£¿Èç¹ûÄܵĻ°£¬ÎªÊ²Ã´Âð£¿
ǰЩÌì¿´µ½ÓÐÒ»¸ö³ÌÐòÖÐûÓÐ×îºóÒ»¸öelseÎÒ¾ÍÔÙÏ룬ÔõôûÄǸöÓï·¨ÄØ£¬ºóÀ´ÕÒ°¡ÕÒ£¬Ò²Ã»ÕÒµ½£¬ÔÚÕâÀïÈ´ÕÒµ½´ð°¸ÁË¡£ÏëÖªµÀµÄ»°£¬¿´Ò»ÏÂÏÂÃæµÄ¾ä×ÓÁË£º
  ×îºóÒ»¸öelse²¿·ÖÓÃÓÚ´¦Àí“ÉÏÊöÌõ¼þ¾ù²»³ÉÁ¢µÄÇé¿ö”»òĬÈÏÇé¿ö£¬Ò²¾ÍÊǵ±ÉÏÃæ¸÷Ìõ¼þ¶¼²»Âú×ãʱµÄÇéÐΡ£ÓÐʱºò²¢²»ÐèÒªÕë¶ÔĬÈϵÄÇé¿öÖ´ÐÐÏÔʾµÄ²Ù×÷£¬ÕâÖÖÇé¿öÏ£¬¿ÉÒ԰ѸýṹĩβµÄ£º
  else
  Óï¾ä
 ²¿·ÖÊ¡ÂÔ£»
6,¹ØÓÚÕÛ°ë²éÕҵijÌÐò£¬ÎÒÔø¾­ÃÔ㣺
  Ô­º¯Êý£º
  int binsearch(int x,int v[],int n)
{  int low,high,mid;
low=0;
high=n-1;
while(low<=high){
mid=(low+high)/2;
if(x<v[mid])
high=mid-1;
else if(x>v[mid])
low=mid+1;
else
return mid;
}
return -1;
}
  ÎÒÔø¾­Ð´¹ýÒ»¸öÖ÷º¯ÊýÀ´ÑéÖ¤Õâ¸öº¯Êý£¬µ«ÊÇÔÚµ÷ÓõÄʱºò£¬³öÁËÎÊÌ⣬ÎÒÊÇÕâÑùÀ´µ÷Óõģº
  binsearch(2,v[],6),
  ºóÀ´¸ÄΪbinsearch(2,{1,2,5,8,9,10},6);µ«ÊÇ»¹ÊDz»ÐУ»
  ºóÀ´ÔÚ¸ßÈËÖ¸µãÏ£¬Ã÷°×ÁËÓ¦¸ÃÕâÑùÀ´µ÷Óã


Ïà¹ØÎĵµ£º

CºÍC++µÄµãµÎ»ýÀÛ£¨1£©

                     CºÍC++µÄµãµÎ»ýÀÛ£¨1£©
1. mfc ±à³ÌÖдæÔÚ×ÅÈç¹û³öÏÖ“ÄÚ´æ²»×㔵ĶԻ°¿ò£¬Ò»ÖÖÇé¿öÊÇÔÚÉêÇëÄÚ´æµÄʱºò³öÏÖÎÊÌ⣬Ҳ¾ÍÊÇÀýÈ磺char *pChar = new char[num]; µ«´Ëʱnum ΪÁã»òÕ߸º ......

c/c++ string


1.±¾ÕÂ˼άµ¼Í¼£º



Example1:
char
*strcpy(char *target, const char *source) {
  char *t = target;

  // Copy the contents of source into target.
 
while(*source) *target++ = *source++;
  // Null-terminate the
target.
  *ta ......

#ifdef __cplusplus extern "C" { #endif µÄ½âÊÍ

¹ØÓÚ#ifdef __cplusplus extern 
ÃæÊÔʱ±»Îʵ½¹ý£¬²»ÉõÃ÷ÁË£¬ÍøÉÏ°Ù¶Èһϣ¬ÕûºÏÁËÁ½¸öÈÊÐÖµÄÎÄÕ£¬ÈçÏ¡£:-)
ʱ³£ÔÚcppµÄ´úÂëÖ®Öп´µ½ÕâÑùµÄ´úÂë:
#ifdef __cplusplus
extern "C" {
#endif
//Ò»¶Î´úÂë
#ifdef __cplusplus
}
#endif
¡¡¡¡
    ÕâÑùµÄ´úÂëµ½µ×ÊÇʲôÒâ˼ÄØ£¿Ê×ÏÈ£¬ ......

C/C++¿ª·¢¾­ÑéÈ˲ÅÇë½ø£¡

ÉÏÖÜÀÏ°å·ÖÏÂÀ´6¸öְλÈí¼þ¿ª·¢·½ÃæµÄְλ¸øÎÒ£¬ÒªÎÒ°´Ö°Î»ÒªÇóÑ°ÕÒºÏÊʵÄÈ˲š£¾ÓÈ»ÊÇC/C++!¾ÝÎÒËùÖª£¬ÔÚÈ˲ſâÖУ¬JAVA È˲ŵ¹ÊÇÓ¦Óо¡ÓУ¬Ñ§CµÄ£¬»¹ÊÇǶÈëʽ¿ª·¢µÄ¿ÉÕæµÄºÃÉÙ°¡¡£ÎÒÓÖ²»ÊÇŮ洣¬ÄѵÀÎÒ»áÔìÈ˲Åô£¿ÒªÇóÌõ¼þ»¹Õâô¸ß£¡
ÒÔÏÂÊÇ´óÁ¬Èí¼þÔ°¼¸¼ÒÖªÃûÍâÆóίÍÐÎÒÃÇÕÐƸµÄְλÐÅÏ¢¡£
Position 1 Èí¼þ¿ª·¢¹¤³Ìʦ ......

C/C++λ²Ù×÷

C/C++λ²Ù×÷
Ò»¡¢´«Í³µÄC·½Ê½Î»²Ù×÷£º
1.»ù±¾²Ù×÷£º
  ʹÓÃÒ»¸öunsigned int±äÁ¿À´×÷ΪλÈÝÆ÷¡£
2.²Ù×÷·û£º
|  °´Î»»ò²Ù×÷·û£ºresult=exp1|exp2;µ±exp1ºÍexp2ÖжÔӦλÖÐÖÁÉÙÓÐÒ»¸öΪ1ʱ£¬resultÖжÔӦλΪ1£¬·ñÔòΪ0¡£
&  °´Î»Óë²Ù×÷·û£º£ºresult=exp1&exp2;µ±exp1ºÍexp2ÖжÔӦλȫΪ1ʱ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ