Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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++ÓïÑÔÈëÃÅƪ¡¿ λÔËËã


»Ø¹Ë֮ǰµÄƪ·ù£¬CÓïÑÔµÄÖ÷Ì岿·Ö»ù±¾ÒѾ­½éÉÜÍêÁË¡£Ö®ËùÒÔûÓнéÉÜC++µÄÏà¹ØÌØÐÔÊÇÒòΪÔÚ֮ǰµÄÎÄÕÂÖÐCºÍC++ÔÚÕâЩ·½Ã涼Óй²ÐÔ£¬ËùÒÔÔÚÃæÏò¶ÔÏó֮ǰ¡£ÎÒÃÇÏÈ°ÑÕâЩ¹²ÐÔ¸ø½éÉÜÍê¡£Ò²¾ÍÊÇ˵ÔÚ½éÉÜÃæÏò¶ÔÏó֮ǰ£¬ËùÓеÄÎÄÕ¶¼ÊÇCC++Öж¼ÄÜʹÓõġ£´ÓÕâµãÉÏÀ´¿´£¬ÏÖÔÚÕý¼«Á¦·Ü¶·ÓÚC++Õ½ÏßÉϵijõѧÕß»¹ÊǺÜÓÐÓô¦µÄ¡£
±¾Æª¼ ......

c/c++Í·Îļþ£¬±£´æ£¬±¸ÓÃ

 
C¡¢´«Í³ C++
#include <stdio.h>¡¡¡¡¡¡¡¡ //¶¨ÒåÊäÈ룯Êä³öº¯Êý
#include <stdlib.h>¡¡¡¡¡¡¡¡//¶¨ÒåÔÓÏÊý¼°ÄÚ´æ·ÖÅ亯Êý
#include <string.h>¡¡¡¡¡¡¡¡//×Ö·û´®´¦Àí
#include <assert.h>¡¡¡¡¡¡¡¡//É趨²åÈëµã
#include <ctype.h>¡¡¡¡¡¡¡¡ //×Ö·û´¦Àí
#include <errno.h&g ......

c±ê×¼

developerWorks Öйú > Linux > Óà C99 ½øÐпª·ÅÔ´´úÂëµÄ¿ª·¢ÄúµÄ C ´úÂë·ûºÏ±ê×¼Â𣿠ÎĵµÑ¡Ïî ´òÓ¡±¾Ò³ ½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ ¼¶±ð£º ³õ¼¶ Peter Seebach (developerworks@seebs.plethora.net), ×ÔÓÉ×÷¼Ò 2004 Äê 4 Ô 01 ÈÕ C99 ÊÇʲô£¿Ë­ÐèÒªËü£¿Ëü¿ÉÓÃÁËÂð£¿Poter Seebach ÌÖÂÛÁË ISO C ±ê×¼µÄ 1999 ÄêÐÞ¶©°æ ......

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

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

TCP£¨SOCKETS£©±à³Ì C/C++ʵÏÖ

ͨÐÅ
Server£º
#pragma comment(lib, "ws2_32.lib")
#include <Winsock2.h>
#include <stdio.h>

void main()
{
//°æ±¾Ð­ÉÌ
WORD wVersionRequested;
WSADATA wsaData;
int err;

wVersionRequested = MAKEWORD(1,1); //0x0101
err = WSAStartup ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ