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

[C]CÓïÑÔ»ù´¡¹®¹ÌרÌâ Á´±íÖ®£¨Á´±í´´½¨ºÍɾ³ý£©

 Á´±íÖÐÓÐÁ½¸ö¹Ø¼üµÄ²Ù×÷£º´´½¨ºÍɾ³ý¡£½ñÌìÎҾͶÔÕâÁ½¸ö²Ù×÷½øÐнéÉÜ£¬
´ÓÕâÁ½¸ö²Ù×÷ÖÐѧϰµ½Á´±íµÄ»ù±¾Ó÷¨¡£
1. Create
   Create() ÊÇÒ»¸öÁ´±í»ù´¡£¬Ö»Óн¨Á¢ºÃÁ´±í²ÅÄܶÔËü½øÐÐÏàÓ¦µÄ²éÕÒ£¬É¾³ý µÈ¡£
  »ù±¾Ëã·¨£º
  1.³õʼ»¯
     head=NULL;
     ls=new test£»
    cin>>ls->num;
    Í·½áµãÖ¸ÏòNULL£¬ ´´½¨Ò»¸ö½Úµã£¬ÊäÈënum¡£
   le £ºÕâ¸öÖ¸ÕëÓÃÓڼǼ×îºóÒ»¸öÔÚÁ´±íÉϵĽڵ㣬·Ç³£useful.
 2.½øÈëÑ­»·£¬Ìõ¼þÊÇnum!=0.
    1) ÅжÏhead==NULL,
         Èç¹ûÎªÕæ£¬±íÃ÷Á´±íΪ¿Õ£¬
           Ôò½«½ÚµãÁ¬½Óµ½headÉÏ¡£
        ·ñÔò½«½ÚµãÁ¬µ½×îºóÒ»¸ö½ÚµãÉÏ¡£
    2)  ΪºóÃæµÄÑ­»·×ö×¼±¸
          leÇ°ÒÆ:le=ls;
          ls ¿ª±Ùнڵ㣬¸³Öµ: ls=new test; cin>>ls->num.
  3.ÊÕβ
    ÔÚ֮ǰ¶à¿ª±Ù³öÒ»¸ö½Úµã£¬Òª½«Æäɾ³ý£¬ÁíÍâ¾ÍÊÇleÊÇÖ¸Ïò×îºóÒ»¸ö½ÚµãµÄ
£¬ËùÒÔ½«le->next=NULL.
£¨´ËËã·¨»¹ÓиĽøµÄµØ·½£¬ÄǾÍÊÇ¿ÉÒÔÏÈÅжÏnumÊÇ·ñΪ0 ÔÚ¾ö¶¨ÊÇ·ñ¿ª±Ù£©
struct test
{
int num;
test * next;
};
test * head;
test * create()
{
head=NULL;
test * ls,le;
ls=new test;
cin>>ls->num;
le=ls;
while(ls->num!=0)
{
if(head==NULL)
{
head=ls;
}
else{
le->next=ls;
}
le=ls;
ls=new test;
cin>>ls->num;
}
le->next=NULL;
delete ls;
return head;
}
  2. Delete
 Delete ÊÇÔÚ¸ø¶¨Ò»¸öÁ´±íµÄÍ·½áµãµÄÖ¸ÕëºÍҪɾ³ýµÄÒ»¸öÊý£¬½ø¶ø¶ÔÆäɾ³ý¡£
»ù±¾Ëã·¨ÈçÏ£º
 ÓÉÓÚɾ³ýµÄʱºòÒª¿¼ÂÇÈýÖÖÇé¿ö£º
   1. Èç¹ûheadΪ¿Õ£¬Ö±½Ó·µ»Ø
   2.Èç¹ûɾ³ýµÄΪÊ׽ڵ㣬ÔòÒª½«´Î½ÚµãµÄµØÖ··µ»Ø¸øhead
   3.ʣϵÄÇé¿ö¾ÍÊÇÖмäºÍĩβµÄ½Úµ


Ïà¹ØÎĵµ£º

¡¾C\C++ÓïÑÔÈëÃÅÆª¡¿ µ÷ÊÔ»ù´¡

ͨ¹ýÇ°ÃæÁ½Æª£¬ÏàÐÅ´ó¼ÒÒѾ­»ù±¾Á˽âÁËÎÒÃǵÄÑо¿Ë¼Â·¡£¼ÈÈ»ÊÇÑо¿£¬ÄÇô±ØÐëµÄÑо¿¹¤¾ß¾ÍµÃÊìÁ·ÕÆÎÕÁË¡£ÕâÀïÎÒËùÖ¸µÄÑо¿¹¤¾ß¾ÍÊÇVC£¬ÎÒËùʹÓõÄVC°æ±¾ÊÇ2005¡£±¾ÎÄÒ²½«¸ù¾ÝVC2005½øÐÐ̽ÌÖ¡£¿ÉÄܺܶàÅóÓÑ»òÕß³õѧÕß»¹ÊÇʹÓõÄVC6.0¡£ÔÚÕâÀï±¾È˲»ÍƼöʹÓÃVC6.0¡£Ô­ÒòºÜ¼òµ¥£¬VC6.0ÒѾ­¹ýʱÁË£¬ºóÃæµÄ°æ±¾±ÈVC6.0¸üÇ¿´ó·½±ã ......

cº¯Êý: strtok ºÍ strtok_r

º¯ÊýÃû:   strtok    
  ¹¦     ÄÜ:   ²éÕÒÓÉÔÚµÚ¶þ¸ö´®ÖÐÖ¸¶¨µÄ·Ö½ç·û·Ö¸ô¿ªµÄµ¥´Ê    
  ÓÃ     ·¨:   char   *strtok(char   *str1,   char   *str2);    
  ³ÌÐòÀý:    
   
&nbs ......

¼òµ¥µÄcÊý×Ö³ÌÐò

#include <stdio.h>
int main()
{
int i = 1;
int j = 0;
int k = 0;
for(;i<6;i++)
{
k = i;
for(j = 0;j<i;j++,k++)
{
printf("%d ",k);
}
printf("\n");
}
}
ºÜ¼òµ¥µÄ³ÌÐò£¬¿´ÓÐÈËÎÊ£¬¾ÍÏ´¶öÁ˷ŵ½ÕâÁË¡£¡£¡£
ÐÐÁж¼ºÜÓйæÂÉ¡£¡£¡£¡£
Á½¸öÑ­»·¡£¡£¡£
ÔËÐнá¹û ......

c/c++ ºó׺ÃûÏê½â


.APS£º´æ·Å¶þ½øÖÆ×ÊÔ´µÄÖмäÎļþ£¬VC°Ñµ±Ç°×ÊÔ´Îļþת»»³É¶þ½øÖƸñʽ£¬²¢´æ·ÅÔÚAPSÎļþÖУ¬ÒÔ¼Ó¿ì×ÊÔ´×°ÔØËÙ¶È¡£×ÊÔ´¸¨ÖúÎļþ¡£
.BMP£ºÎ»Í¼×ÊÔ´Îļþ¡£
.BSC£ºä¯ÀÀÐÅÏ¢Îļþ£¬ÓÉä¯ÀÀÐÅϢά»¤¹¤¾ß£¨BSCMAKE£©´Óԭʼä¯ÀÀÐÅÏ¢Îļþ£¨.SBR£©ÖÐÉú³É£¬BSCÎļþ¿ÉÒÔÓÃÀ´ÔÚÔ´´úÂë±à¼­´°¿ÚÖнøÐпìËÙ¶¨Î»¡£ÓÃÓÚä¯ÀÀÏîÄ¿ÐÅÏ¢µÄ£¬Èç¹ûÓ ......

[C]CÓïÑÔ»ù´¡¹®¹ÌרÌâ Á´±íÖ®£¨Á´±í·´×ª£©

 Á´±íÊÇcÓïÑÔÖкÜÖØÒªµÄÊý¾Ý½á¹¹£¬ÊÇ¿¼²ìÒ»¸ö³ÌÐòÔ±µÄ»ù±¾¹¦µÄÊֶΣ¬Ö®Ç°ÔÚÒ»¼Ò¹«Ë¾ÃæÊÔʱ¾ÍÎʵ½ÁË
ʵÏÖÒ»¸öÁ´±íµÄ·´×ª£¬µ±Ê±¾ÍÊÇûÓкܺÃÀä¾²µÄ˼¿¼£¬½ñÌìÔÚÕâÀïд³öÀ´£¬¹²Ã㣡
 »ù±¾Ëã·¨£º
       1. ÅжÏÊÇ·ñΪ¿Õ£¬Èç¹ûΪ¿Õ£¬·µ»ØNULL
       ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ