| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> c/c++ >> C/C++ zhong jie gou ti (struct) zhi shi dian qiang hua

C/C++ zhong jie gou ti (struct) zhi shi dian qiang hua

2008-06-01 02:09:02 编辑來源:互联网 评论
 
 
 
本文为【C/C++中结构体(struct)知识点强化】的拼音翻译版
  zai shang yi ge jiao cheng zhong wo men yi jing jian dan de chan shu le shen me shi jie gou ti le , wei le jin yi bu de xue xi jie gou ti zhe yi chong yao de zhi shi dian , wo men jin tian lai xue xi yi xia lian biao jie gou 。 jie gou ti ke yi kan zuo shi yi zhong zi ding yi de shu ju lei xing , ta huan you yi ge hen chong yao de te xing , jiu shi jie gou ti ke yi xiang hu qian tao shi yong , dan ye shi you tiao jian de , jie gou ti ke yi bao han jie gou ti zhi zhen , dan jue dui bu neng zai jie gou ti zhong bao han jie gou ti bian liang 。
  strUCt test
  {
   char name[10];
   float socre;
   test *next;
  };// zhe yang shi zheng que de !
  struct test
  {
   char name[10];
   float socre;
   test next;
  };// zhe yang shi cuo wu de !
  li yong jie gou ti de zhe dian fei fan te xing , wo men jiu ke yi zi ji sheng cheng yi ge huan huan xiang tao de yi zhong she xian jie gou , yi ge zhi xiang ling yi ge 。
  lian biao de xue xi bu xiang xiang xiang de na me na me qing yi , hen duo ren xue xi dao zhe li de shi hou dou hui peng dao kun nan , hen duo ren ye yin ci er fang qi le xue xi , zai zhe li wo shuo , yi ding bu neng fang qi , dui ying ta de xue xi wo men yao jin xing fen jie shi xue xi , fang fa hen chong yao , li jie xu yao shi jian , bu bi yao ba zi ji bi po de na me jin , xue xi qian ni ye de zuo yi xie zui ji ben de yu bei gong zuo , ni bi xu ju bei dui dui nei cun de ji ben zhi shi de le jie , huan you jiu shi dui jie gou ti de ji ben shu xi , you le zhe liang ge chong yao de tiao jian , zai jin xing fen jie shi xue xi jiu ke yi bi jiao qing song de ba wo zhe yi jie nei rong de nan dian 。
  xia mian wo men gei chu yi ge wan zheng de chuang jian lian biao de cheng xu , bu guan kan de dong kan bu dong xi wang du zhe xian ren zhen kan yi xia , xiang yi xiang , kan bu dong mei you guan xi , yin wei wo xia mian hui you fen jie shi de jiao cheng , dan zhi qian de ji ben si kao yi ding yao zuo , yao bu ji shi wo fen jie le ni ye shi wu cong li jie de 。
  dai ma ru xia , wo zai chong yao bu fen zuo le zhu jie :
  #include <iostream>
  using namespace std;
  struct test
  {
   char name[10];
   float socre;
   test *next;
  };
  test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen
  test *create()
  {
   test *ls;// jie dian zhi zhen
   test *le;// lian yi zhi zhen
   ls = new test;// ba ls zhi xiang dong tai kai pi de dui nei cun di zhi
   cin>>ls->name>>ls->socre;
   head=NULL;// jin ru de shi hou xian bu she zhi head zhi zhen zhi xiang ren he di zhi , yin wei bu zhi dao shi fou yi shang lai jiu shu ru null tiao chu cheng xu
   le=ls;// ba lian yi zhi zhen she zhi cheng gang gang dong tai kai pi de dui nei cun di zhi , yong yu deng xia she zhi le->next, ye jiu shi xia yi ge jie dian de wei zhi
   while(strcmp(ls->name,"null")!=0)// chuang jian xun huan tiao jian wei ls->name de zhi bu shi null, yong yu xun huan tian jia jie dian
   {
   if(head==NULL)// pan ding shi fou shi di yi ci jin ru xun huan
   {
   head=ls;// jia ru shi di yi ci jin ru xun huan , na me ba yin dao jin ru lian biao de zhi zhen zhi xiang di yi ci dong tai kai pi de dui nei cun di zhi
   }
   else
   {
   le->next=ls;// jia ru bu shi di yi ci jin ru na me jiu ba shang yi ci de lian yi zhi zhen de le->next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi
   }
   le=ls;// she zhi lian yi zhi zhen wei dang qian xun huan zhong de jie dian zhi zhen , yong yu xia yi ci jin ru xun huan de shi hou ba shang yi ci de jie dian de next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi
  
   ls=new test;// wei xia yi ge jie dian zai dui nei cun zhong dong tai kai pi kong jian
   cin>>ls->name>>ls->socre;
   }
   le->next=NULL;// ba lian yi zhi zhen de next she zhi wei kong , yin wei bu guan ru he xun huan zong shi yao jie shu de , she zhi wei kong cai neng gou zai xun huan xian lian biao de shi hou bu zhi yu si xun huan
   delete ls;// dang jie shu de shi hou zui hou yi ge dong tai kai pi de nei cun shi wu xiao de , suo yi bi xu qing chu diao
   return head;// fan hui lian shou zhi zhen
  }
  void showl(test *head)
  {
   cout<<" lian shou zhi zhen :"<<head<<endl;
   while(head)// yi nei cun zhi xiang wei null wei tiao jian xun huan xian shi xian qian shu ru de nei rong
   {
   cout<<head->name<<""<<head->socre<<endl;
   head=head->next;
   }
  }
  void main()
  {
   showl(create());
   cin.get();
   cin.get();
  }
  shang mian de dai ma wo men shi yao da dao yi ge mu de : jiu shi yao cun chu ni shu ru de ren ming he ta men de de fen , bing qie yi lian zhuang jie gou ba ta men zu he cheng yi ge lian zhuang jie gou 。
C/C++中结构体(struct)知识点强化
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo
  cheng xu zhong you liang ge zu cheng bu fen
  test *create() he
  void showl(test *head)
   zhe liang ge han shu ,create shi yong lai chuang jian lian biao de ,showl shi yong lai xian shi lian biao de 。
  create han shu de fan hui lei xing shi yi ge jie gou ti zhi zhen , zai cheng xu tiao yong de shi hou wo men yong le showl(create());, er bu yong yin yong de mu de yuan yin shi yin dao zhi zhen shi yi ge quan ju zhi zhen bian liang , wo men bu neng zai showl() nei gai bian ta , yin wei showl() han shu nei you yi ge yi dong cao zuo head=head->next;, jia ru shi yin yong de hua wo men jiu po huai le head zhi zhen de wei zhi , yi zhi yu wo men zai ye wu fa zhao hui shou di zhi de wei zhi le 。
  xia mian wo men lai fen jie zheng ge cheng xu , yi yi ge chu xue zhe de si xiang lai si kao zheng ge cheng xu , you qian ru shen de zhu bu jie shi 。
  shou xian , wo men xie zhe ge cheng xu , yao kao lv dao you yu shi yi ge lian biao jie gou , wo men bu ke neng zhi dao ta de da xiao dao di shi duo da , zhe ge wen ti wo men ke yi yong dong tai kai pi dui nei cun lai jie jue , yin wei dui nei cun zai cheng xu jie shu qian shi zhong shi you xiao de , bu shou han shu zhan kong jian sheng ming qi de xian zhi , dan yao zhu chong de shi wo men bi xu you yi ge zhi zhen bian liang lai cun chu zhe yi lian zhuang jie gou de jin ru di zhi , er zai han shu nei bu lai jian li zhe yi zhi zhen bian liang xian ran shi bu he shi de , yin wei han shu yi dan tui chu , zhe ge zhi zhen bian liang ye sui zhi shi xiao , suo yi wo men zai cheng xu de kai shi sheng ming le yi ge quan ju zhi zhen bian liang 。
  test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen
  hao jie jue le zhe liang ge wen ti , wo men jie xia qu si kao
  you shu ru jiu bi ran you shu chu , you yu shu chu han shu he shu ru han shu shi xiang dui du li de , wei le bu duan ce shi cheng xu de zheng que xing hao tiao shi wo men xian xie hao shu chu han shu he main han shu nie de tiao yong , chuang jian han shu wo men xian yue ding hao ming wei create。
  wo men xian xie chu ru xia de dai ma :
  #include <iostream>
  using namespace std;
  struct test
  {
   char name[10];
   float socre;
   test *next;
  };
  test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen
  test *create()
  {
   return head;// fan hui lian shou zhi zhen
  
   }
  void showl(test *head)
  {
   cout<<" lian shou zhi zhen :"<<head<<endl;
   while(head)// yi nei cun zhi xiang wei null wei tiao jian xun huan xian shi xian qian shu ru de nei rong
   {
   cout<<head->name<<""<<head->socre<<endl;
   head=head->next;
   }
  }
  void main()
  {
   showl(create());
   cin.get();
   cin.get();
  }
  cheng xu xie dao zhe li , ji ben xing tai yi jing chu lai , shu ru he tiao yong wo men yi jing you le 。
  xia mian wo men lai jie jue shu ru wen ti , lian biao de shi xian wo men shi tong guo xun huan shu ru lai shi xian de , ji ran shi xun huan wo men jiu yi ding de kao lv zhong zhi xun huan de tiao jian , bi mian si xun huan he wu xiao xun huan de fa sheng 。
C/C++中结构体(struct)知识点强化
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo
  zai create() han shu nei bu wo men xian xie cheng zhe yang :
  
  test *create()
  {
   test *ls;// jie dian zhi zhen
   test *le;// lian yi zhi zhen
   ls = new test;// ba ls zhi xiang dong tai kai pi de dui nei cun di zhi
   cin>>ls->name>>ls->socre;
   head=NULL;// jin ru de shi hou xian bu she zhi head zhi zhen zhi xiang ren he di zhi , yin wei bu zhi dao shi fou yi shang lai jiu shu ru null tiao chu cheng xu
   le=ls;// ba lian yi zhi zhen she zhi cheng gang gang dong tai kai pi de dui nei cun di zhi , yong yu deng xia she zhi le->next, ye jiu shi xia yi ge jie dian de wei zhi
  
   le->next=NULL;// ba lian yi zhi zhen de next she zhi wei kong , yin wei bu guan ru he xun huan zong shi yao jie shu de , she zhi wei kong cai neng gou zai xun huan xian lian biao de shi hou bu zhi yu si xun huan
   delete ls;// dang jie shu de shi hou zui hou yi ge dong tai kai pi de nei cun shi wu xiao de , suo yi bi xu qing chu diao
   return head;// fan hui lian shou zhi zhen
  }
  zai xun huan chuang jian zhi qian wo men bi xu kao lv yi ge dou bu shu ru de qing kuang 。
  cheng xu yi dan jin ru create han shu wo men shou xian bi ran yao chuang jian yi ge jie dian , wo men xian chuang jian yi ge jie dian zhi zhen , hou ba zhe ge jie dian zhi zhen zhi xiang dao dong tai kai pi de test lei xing de dong tai nei cun di zhi wei zhi shang 。
  suo yi wo men you le
  test *ls;
  ls = new test;
  cheng xu ji ran shi xun huan shu ru , er jie gou cheng yuan test *next you shi yong lai cun chu xia yi ge jie dian de nei cun di zhi de , mei ci xun huan wo men you yao dong tai chuang jian yi ge xin de nei cun kong jian , suo yi wo men bi xu yao you yi ge zhi zhen lai cun chu shang yi ci xun huan dong tai kai pi de nei cun di zhi , yu shi jiu you le
  test *le;
  jie xia lai zai jin ru xun huan qian wo men yao chuang jian lian biao de di yi ge jie dian , di yi ge jie dian bi ran shi zai xun huan wai chuang jian , yu shi jiu you le
  cin>>ls->name>>ls->socre;
  cheng xu zhi xing zhe de qing kuang shi wei zhi de , suo yi wo men bi ran yao kao lv , yi shang lai jiu bu xiang ji xu yun xing cheng xu de qing kuang , suo yi wo men yi kai shi xian ba head yin dao zhi zhen she zhi wei bu zhi xiang ren he di zhi ye jiu shi
  head=NULL;
  wei le fu he le ye jiu shi lian yi zhi zhen de she ji si lu , wo men zai xun huan qian yi ding yao bao cun gang gang dong tai kai pi de nei cun di zhi , hao zai xia yi ci xun huan de shi hou she zhi shang yi ge jie dian zhong de next cheng yuan zhi xiang , yu shi wo men bian you le :
  le=ls;
  wei le shi xian xun huan shu ru wo men you le xia mian de dai ma :
  while(strcmp(ls->name,"null")!=0)
  {
  if(head==NULL)
  {
  head=ls;
  }
  else
  {
  le->next=ls;
  }
  le=ls;
  ls=new test;
  cin>>ls->name>>ls->socre;
  }
  cheng xu shi xun huan bi ran yao you zhong zhi xun huan de tiao jian , suo yi wo men de xun huan tiao jian shi :
  while(strcmp(ls->name,"null")!=0)
  shu ru de ming zi shi null de shi hou jiu ting zhi xun huan 。
  
  
  wei le bao zheng di yi ci jin ru xun huan , ye jiu shi zai xun huan nei yu bei chuang jian di er ge jie dian qian , she zhi yin dao zhi zhen de zhi xiang wo men you le ru xia de pan ding dai ma :
  if(head==NULL)
  {
  head=ls;
  }
  else
  {
  le->next=ls;
  }
C/C++中结构体(struct)知识点强化
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo
  dai ma zhong de else tiao jian shi wei le she zhi qian yi ge jie dian next zhi xiang er xie de , zhe dian wo men ji zhu xian kan xia mian de dai ma , shao hou da jia hui guo tou xiang jiu ming bai le
  le=ls;
  ls=new test;
  cin>>ls->name>>ls->socre;
  
  le=ls; zhe me xie jiu shi wei le bao cun shang yi ci xun huan zhi zhen de wei zhi er she de , zheng shi wei le shang mian de else dai ma er zuo de yu xian bao liu
  ls=new test;
  cin>>ls->name>>ls->socre;
  zhe liang xing dai ma de yi si jiu shi ji xu kai pi xia yi ge jie dian kong jian , he shu ru jie dian nei rong !
  xun huan yi dan jie shu ye jiu jie shu le cheng xu , wei le bao chi cheng xu bu chu cuo , ye jiu shi zui hou yi ge jie dian de next cheng yuan zhi xiang wei kong wo men you le xia mian de dai ma
  le->next=NULL;
  cheng xu de si lu shi zhong shi yi xian kai pi hou pan ding wei si lu de , suo yi dao zui hou yi ge bu cheng li de shi hou zong hui you yi ge duo kai pi de nei cun kong jian , wei le shan chu diao ta , wo men you le xia mian de dai ma
  delete ls;
  cheng xu dao zui hou you yu fan hui head zhi zhen
  return head;
  xian shi lian biao de han shu mei you shen me tai duo fei fan de ye zhi xu yao zhu chong xia mian zhe yang jiu ke yi le !
  head=head->next;
  wo men zhi suo yi bu yong head+=1; lai xie jiu shi yin wei lian biao shi wo men dong tai kai pi de , er mei yi ge jie dian de wei zhi bing bu shi xiang lian de ,next cheng yuan zhi zhen de yi yi ye jiu shi xia yi ge jie dian de nei cun di zhi 。
  dao zhe li zheng ge chuang jian han shu de she ji si lu ye dou shuo wan le , bi zhe bu yi ding shuo de hen hao , dan ji ben si lu shi zhe yang de , xi wang du zhe duo si kao , duo dui bi , xiang xin ci jiao cheng huan shi dui da jia you bang zhu de , cheng xu she ji jiu shi li yong zhu bu si kao de fang shi jin xing de , xie hao de dai ma wang wang zhi jie kan kan bu dong jiu shi yin wei zhong jian de xi jie bing bu shi yi ci dou neng gou xiang dao de 。
  xia mian wo men lai shuo yi xia lian biao jie dian de shan chu !
  wo men yi shang mian de cheng xu wei ji chu , dan wei le wo men fang bian xue xi shan chu wo men xiu zheng jie gou ti wei
  struct test
  {
  int number;
  float socre;
  test *next;
  };
  number wei wei yi de bian hao mei yi ge jie dian de 。
  shan chu de wo jiu bu duo shuo le , li mian chong yao bu fen you zhu jie 。
  fei fan zhu chong deletel han shu de shen shu yi yi , zhi zhen de yin yong zai zhe li hen chong yao , jia ru zhi shi zhi zhen , huo zhe zhi shi ying yong dou shi bu xing de , wei shen me zai xi si kao , hen duo zhi ming de jiao cai zai zhe yi wen ti shang dou hen mo hu , er qie hen duo shu huan you cuo wu , cheng xu bu cuo , dan si lu shi cuo de , wo zhe li fei fan bu shuo , qing da jia zai xi yue du cheng xu , jia ru huan shi you wen ti , ke yi hui ci tie , wo hui hui da de 。
C/C++中结构体(struct)知识点强化
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo
  wan zheng dai ma ru xia :
  #include <iostream>
  using namespace std;
  struct test
  {
  
   int number;
   float socre;
   test *next;
  };
  test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen
  test *create()
  {
   test *ls;// jie dian zhi zhen
   test *le;// lian yi zhi zhen
   ls = new test;// ba ls zhi xiang dong tai kai pi de dui nei cun di zhi
   cin>>ls->number>>ls->socre;
   head=NULL;// jin ru de shi hou xian bu she zhi head zhi zhen zhi xiang ren he di zhi , yin wei bu zhi dao shi fou yi shang lai jiu shu ru null tiao chu cheng xu
   le=ls;// ba lian yi zhi zhen she zhi cheng gang gang dong tai kai pi de dui nei cun di zhi , yong yu deng xia she zhi le->next, ye jiu shi xia yi ge jie dian de wei zhi
  
   while(ls->number!=0)// chuang jian xun huan tiao jian wei ls->number de zhi bu shi null, yong yu xun huan tian jia jie dian
   {
   if(head==NULL)// pan ding shi fou shi di yi ci jin ru xun huan
   {
   head=ls;// jia ru shi di yi ci jin ru xun huan , na me ba yin dao jin ru lian biao de zhi zhen zhi xiang di yi ci dong tai kai pi de dui nei cun di zhi
   }
   else
   {
   le->next=ls;// jia ru bu shi di yi ci jin ru na me jiu ba shang yi ci de lian yi zhi zhen de le->next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi
   }
   le=ls;// she zhi lian yi zhi zhen wei dang qian xun huan zhong de jie dian zhi zhen , yong yu xia yi ci jin ru xun huan de shi hou ba shang yi ci de jie dian de next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi
   ls=new test;// wei xia yi ge jie dian zai dui nei cun zhong dong tai kai pi kong jian
   cin>>ls->number>>ls->socre;
   }
   le->next=NULL;// ba lian yi zhi zhen de next she zhi wei kong , yin wei bu guan ru he xun huan zong shi yao jie shu de , she zhi wei kong cai neng gou zai xun huan xian lian biao de shi hou bu zhi yu si xun huan
   delete ls;// dang jie shu de shi hou zui hou yi ge dong tai kai pi de nei cun shi wu xiao de , suo yi bi xu qing chu diao
   return head;// fan hui lian shou zhi zhen
  }
  void showl(test *head)
  {
   cout<<" lian shou zhi zhen :"<<head<<endl;
   while(head)// yi nei cun zhi xiang wei null wei tiao jian xun huan xian shi xian qian shu ru de nei rong
   {
   cout<<head->number<<""<<head->socre<<endl;
   head=head->next;
   }
  }
  void deletel(test *&head,int number)// zhe li jia ru shen shu huan cheng test *head, yi yi jiu wan quan bu tong le ,head bian cheng le fu zhi er bu shi yuan you lian shang cao zuo le , fei fan zhu chong , hen duo shu shang dou bu dui zhe li
  {
   test *point;// pan ding lian biao shi fou wei kong
   if(head==NULL)
   {
   cout<<" lian biao wei kong , bu neng jin xing shan chu gong zuo !";
   return;
   }
   if(head->number==number)// pan shan chu de jie dian shi fou wei shou jie dian
   {
   point=head;
   cout<<" shan chu dian shi lian biao di yi ge jie dian wei zhi !";
   head=head->next;// chong xin she zhi yin dao zhi zhen
   delete point;
   return;
   }
   test *fp=head;// bao cun lian shou zhi zhen
  
   for(test *&mp=head;mp->next;mp=mp->next)
   {
   if(mp->next->number==number)
   {
   point=mp->next;
   mp->next=point->next;
   delete point;
   head=fp;// you yu head de bu duan yi dong diu shi le head, ba jin ru xun huan qian de head zhi zhen hui fu !
   return;
   }
   }
  }
  void main()
  {
   head=create();// tiao yong chuang jian
   showl(head);
   int dp;
   cin>>dp;
   deletel(head,dp);// tiao yong shan chu
   showl(head);
   cin.get();
   cin.get();
  }
C/C++中结构体(struct)知识点强化
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo
  zui hou wo xue xi yi xia ru he zai yi you de lian biao shang cha ru jie dian
  wo men yao kao lv si zhong qing kuang ,
  1. lian biao wei kong !
  2. cha ru dian zai shou jie dian qian
  3. cha ru dian zhao bu dao de qing kuang wo men she zhi fang zai zui hou !
  4. cha ru dian zai zhong jian de qing kuang !
  
   jin tian de cheng xu zai zuo tian de ji chu shang zuo le jin yi bu de xiu gai , ke yi bi mian shan chu dian zhao bu dao de qing kuang , jia ru zhao bu dao shan chu dian jiu tui chu han shu !
  #include <iostream>
  using namespace std;
  struct test
  {
   int number;
   float socre;
   test *next;
  };
  test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen
  test *create()
  {
   test *ls;// jie dian zhi zhen
   test *le;// lian yi zhi zhen
   ls = new test;// ba ls zhi xiang dong tai kai pi de dui nei cun di zhi
   cout<<" qing shu ru di yi ge jie dian number he jie dian score, shu ru 0.0 tiao chu han shu "<<endl;
   cin>>ls->number>>ls->socre;
   head=NULL;// jin ru de shi hou xian bu she zhi head zhi zhen zhi xiang ren he di zhi , yin wei bu zhi dao shi fou yi shang lai jiu shu ru null tiao chu cheng xu
   le=ls;// ba lian yi zhi zhen she zhi cheng gang gang dong tai kai pi de dui nei cun di zhi , yong yu deng xia she zhi le->next, ye jiu shi xia yi ge jie dian de wei zhi
   while(ls->number!=0)// chuang jian xun huan tiao jian wei ls->number de zhi bu shi null, yong yu xun huan tian jia jie dian
   {
  
   if(head==NULL)// pan ding shi fou shi di yi ci jin ru xun huan
   {
   head=ls;// jia ru shi di yi ci jin ru xun huan , na me ba yin dao jin ru lian biao de zhi zhen zhi xiang di yi ci dong tai kai pi de dui nei cun di zhi
   }
   else
   {
   le->next=ls;// jia ru bu shi di yi ci jin ru na me jiu ba shang yi ci de lian yi zhi zhen de le->next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi
   }
   le=ls;// she zhi lian yi zhi zhen wei dang qian xun huan zhong de jie dian zhi zhen , yong yu xia yi ci jin ru xun huan de shi hou ba shang yi ci de jie dian de next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi
   ls=new test;// wei xia yi ge jie dian zai dui nei cun zhong dong tai kai pi kong jian
   cout<<" qing xia yi ge jie dian number he jie dian score, shu ru 0.0 tiao chu han shu "<<endl;
   cin>>ls->number>>ls->socre;
   }
   le->next=NULL;// ba lian yi zhi zhen de next she zhi wei kong , yin wei bu guan ru he xun huan zong shi yao jie shu de , she zhi wei kong cai neng gou zai xun huan xian lian biao de shi hou bu zhi yu si xun huan
   delete ls;// dang jie shu de shi hou zui hou yi ge dong tai kai pi de nei cun shi wu xiao de , suo yi bi xu qing chu diao
   return head;// fan hui lian shou zhi zhen
  }
  void showl(test *head)
  {
   cout<<" lian shou zhi zhen :"<<head<<endl;
   while(head)// yi nei cun zhi xiang wei null wei tiao jian xun huan xian shi xian qian shu ru de nei rong
   {
   cout<<head->number<<""<<head->socre<<endl;
   head=head->next;
   }
  }
  void deletel(test *&head,int number)// zhe li jia ru shen shu huan cheng test *head, yi yi jiu wan quan bu tong le ,head bian cheng le fu zhi er bu shi yuan you lian shang cao zuo le , fei fan zhu chong , hen duo shu shang dou bu dui zhe li
  {
   test *point;// pan ding lian biao shi fou wei kong
   if(head==NULL)
   {
   cout<<" lian biao wei kong , bu neng jin xing shan chu gong zuo !";
   return;
   }
   int derror=1;// she zhi zhao bu dao de qing kuang de tiao jian , yu xian she zhi wei zhen
   test *check=head;
   while(check)// li yong xun huan jin xing cha zhao
   {
   if (check->number==number)
   {
   derror=0;// tiao jian zhuan wei jia
   }
   check=check->next;
  
   }
   if(derror)// jia ru wei jia jiu tiao chu han shu
   {
   return;
   }
   if(head->number==number)// pan shan chu de jie dian shi fou wei shou jie dian
   {
   point=head;
   cout<<" shan chu dian shi lian biao di yi ge jie dian wei zhi !";
   head=head->next;// chong xin she zhi yin dao zhi zhen
   delete point;
   return;
   }
   test *fp=head;// bao cun lian shou zhi zhen
   for(test *&mp=head;mp->next;mp=mp->next)
   {
   if(mp->next->number==number)
   {
   point=mp->next;
   mp->next=point->next;
   delete point;
   head=fp;// you yu head de bu duan yi dong diu shi le head, ba jin ru xun huan qian de head zhi zhen hui fu !
   return;
   }
   }
  }
  void insterl(int number)
  {
   test *point=new test;
   cout<<" qing shu ru jie dian number he jie dian score"<<endl;
   cin>>point->number>>point->socre;
   if(head==NULL)// lian biao wei kong de qing kuang xia cha ru
   {
   head=point;
   point->next=NULL;
   return;
   }
   int ierror=1;// she zhi zhao bu dao de qing kuang de tiao jian , yu xian she zhi wei zhen
   test *le;
   test *check=head;
   while(check)// li yong xun huan jin xing cha zhao
   {
   if (check->number==number)
   {
   ierror=0;// tiao jian zhuan wei jia
   }
  
   le=check;
   check=check->next;
   }
   if(ierror)
   {
   cout<<le->number;
   le->next=point;
   point->next=NULL;
   return;
   }
   if(head->number==number)// jian ce shi fou shi zai di yi ge jie dian chu cha ru
   {
   point->next=head;
   head=point;
   return;
   }
   for(test *&mp=head;mp->next;mp=mp->next)// zai lian biao zhong jian cha ru
   {
   if(mp->next->number==number)
   {
   point->next=mp->next;
   mp->next=point;
   return;
   }
   }
  }
  void main()
  {
   head=create();// tiao yong chuang jian
   showl(head);
   int dp;
   cout<<" qing shu ru shan chu dian jia ru zhao bu dao jiu tiao chu han shu "<<endl;
   cin>>dp;
   deletel(head,dp);// tiao yong shan chu
   showl(head);
   int ip;
   cout<<" qing shu ru cha ru dian jia ru zhao bu dao jiu zai lian yi tian jia "<<endl;
   cin>>ip;
   insterl(ip);
   showl(head);
   cin.get();
   cin.get();
  }
  dao ci guan yu jie gou ti de nei rong yi jing quan bu tao lun jie shu , lian biao de jian li shan chu cha ru cao zuo ke yi hen hao de dui qian mian suo xue zhi shi jin xing yi ge zong jie , ta ji kao cha le cheng xu yuan dui nei cun da li jie ( dui nei cun cao zuo 、 zhi zhen cao zuo ) ye kao cha le dui jie gou hua bian cheng ba wo de shu xi cheng xu 。
  yi hou de jiao cheng wo men jiang zhe chong lian xi mian xiang dui xiang de bian cheng de xiang guan zhi shi dian 。
C/C++中结构体(struct)知识点强化
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
   zai shang yi ge jiao cheng zhong wo men yi jing jian dan de chan shu le shen me shi jie gou ti le , wei le jin yi bu de xue xi jie gou ti zhe yi chong yao de zhi shi dian , wo men jin tian lai xue xi yi xia lian biao jie gou 。   jie gou ti ke yi kan zuo shi yi zhong zi ding yi de shu ju lei xing , ta huan you yi ge hen chong yao de te xing , jiu shi jie gou ti ke yi xiang hu qian tao shi yong , dan ye shi you tiao jian de , jie gou ti ke yi bao han jie gou ti zhi zhen , dan jue dui bu neng zai jie gou ti zhong bao han jie gou ti bian liang 。 strUCt test { char name[10]; float socre; test *next; };// zhe yang shi zheng que de ! struct test { char name[10]; float socre; test next; };// zhe yang shi cuo wu de !    li yong jie gou ti de zhe dian fei fan te xing , wo men jiu ke yi zi ji sheng cheng yi ge huan huan xiang tao de yi zhong she xian jie gou , yi ge zhi xiang ling yi ge 。    lian biao de xue xi bu xiang xiang xiang de na me na me qing yi , hen duo ren xue xi dao zhe li de shi hou dou hui peng dao kun nan , hen duo ren ye yin ci er fang qi le xue xi , zai zhe li wo shuo , yi ding bu neng fang qi , dui ying ta de xue xi wo men yao jin xing fen jie shi xue xi , fang fa hen chong yao , li jie xu yao shi jian , bu bi yao ba zi ji bi po de na me jin , xue xi qian ni ye de zuo yi xie zui ji ben de yu bei gong zuo , ni bi xu ju bei dui dui nei cun de ji ben zhi shi de le jie , huan you jiu shi dui jie gou ti de ji ben shu xi , you le zhe liang ge chong yao de tiao jian , zai jin xing fen jie shi xue xi jiu ke yi bi jiao qing song de ba wo zhe yi jie nei rong de nan dian 。    xia mian wo men gei chu yi ge wan zheng de chuang jian lian biao de cheng xu , bu guan kan de dong kan bu dong xi wang du zhe xian ren zhen kan yi xia , xiang yi xiang , kan bu dong mei you guan xi , yin wei wo xia mian hui you fen jie shi de jiao cheng , dan zhi qian de ji ben si kao yi ding yao zuo , yao bu ji shi wo fen jie le ni ye shi wu cong li jie de 。    dai ma ru xia , wo zai chong yao bu fen zuo le zhu jie : #include <iostream> using namespace std; struct test { char name[10]; float socre; test *next; }; test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen test *create() { test *ls;// jie dian zhi zhen test *le;// lian yi zhi zhen ls = new test;// ba ls zhi xiang dong tai kai pi de dui nei cun di zhi cin>>ls->name>>ls->socre; head=NULL;// jin ru de shi hou xian bu she zhi head zhi zhen zhi xiang ren he di zhi , yin wei bu zhi dao shi fou yi shang lai jiu shu ru null tiao chu cheng xu le=ls;// ba lian yi zhi zhen she zhi cheng gang gang dong tai kai pi de dui nei cun di zhi , yong yu deng xia she zhi le->next, ye jiu shi xia yi ge jie dian de wei zhi while(strcmp(ls->name,"null")!=0)// chuang jian xun huan tiao jian wei ls->name de zhi bu shi null, yong yu xun huan tian jia jie dian { if(head==NULL)// pan ding shi fou shi di yi ci jin ru xun huan { head=ls;// jia ru shi di yi ci jin ru xun huan , na me ba yin dao jin ru lian biao de zhi zhen zhi xiang di yi ci dong tai kai pi de dui nei cun di zhi } else { le->next=ls;// jia ru bu shi di yi ci jin ru na me jiu ba shang yi ci de lian yi zhi zhen de le->next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi } le=ls;// she zhi lian yi zhi zhen wei dang qian xun huan zhong de jie dian zhi zhen , yong yu xia yi ci jin ru xun huan de shi hou ba shang yi ci de jie dian de next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi ls=new test;// wei xia yi ge jie dian zai dui nei cun zhong dong tai kai pi kong jian cin>>ls->name>>ls->socre; } le->next=NULL;// ba lian yi zhi zhen de next she zhi wei kong , yin wei bu guan ru he xun huan zong shi yao jie shu de , she zhi wei kong cai neng gou zai xun huan xian lian biao de shi hou bu zhi yu si xun huan delete ls;// dang jie shu de shi hou zui hou yi ge dong tai kai pi de nei cun shi wu xiao de , suo yi bi xu qing chu diao return head;// fan hui lian shou zhi zhen } void showl(test *head) { cout<<" lian shou zhi zhen :"<<head<<endl; while(head)// yi nei cun zhi xiang wei null wei tiao jian xun huan xian shi xian qian shu ru de nei rong { cout<<head->name<<""<<head->socre<<endl; head=head->next; } } void main() { showl(create()); cin.get(); cin.get(); }    shang mian de dai ma wo men shi yao da dao yi ge mu de : jiu shi yao cun chu ni shu ru de ren ming he ta men de de fen , bing qie yi lian zhuang jie gou ba ta men zu he cheng yi ge lian zhuang jie gou 。 [url=http://www.wangchao.net.cn/bbs/pydetail_1785435.html][img]http://image.wangchao.net.cn/it/1323423374709.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo    cheng xu zhong you liang ge zu cheng bu fen test *create()    he void showl(test *head)    zhe liang ge han shu ,create shi yong lai chuang jian lian biao de ,showl shi yong lai xian shi lian biao de 。   create han shu de fan hui lei xing shi yi ge jie gou ti zhi zhen , zai cheng xu tiao yong de shi hou wo men yong le showl(create());, er bu yong yin yong de mu de yuan yin shi yin dao zhi zhen shi yi ge quan ju zhi zhen bian liang , wo men bu neng zai showl() nei gai bian ta , yin wei showl() han shu nei you yi ge yi dong cao zuo head=head->next;, jia ru shi yin yong de hua wo men jiu po huai le head zhi zhen de wei zhi , yi zhi yu wo men zai ye wu fa zhao hui shou di zhi de wei zhi le 。    xia mian wo men lai fen jie zheng ge cheng xu , yi yi ge chu xue zhe de si xiang lai si kao zheng ge cheng xu , you qian ru shen de zhu bu jie shi 。    shou xian , wo men xie zhe ge cheng xu , yao kao lv dao you yu shi yi ge lian biao jie gou , wo men bu ke neng zhi dao ta de da xiao dao di shi duo da , zhe ge wen ti wo men ke yi yong dong tai kai pi dui nei cun lai jie jue , yin wei dui nei cun zai cheng xu jie shu qian shi zhong shi you xiao de , bu shou han shu zhan kong jian sheng ming qi de xian zhi , dan yao zhu chong de shi wo men bi xu you yi ge zhi zhen bian liang lai cun chu zhe yi lian zhuang jie gou de jin ru di zhi , er zai han shu nei bu lai jian li zhe yi zhi zhen bian liang xian ran shi bu he shi de , yin wei han shu yi dan tui chu , zhe ge zhi zhen bian liang ye sui zhi shi xiao , suo yi wo men zai cheng xu de kai shi sheng ming le yi ge quan ju zhi zhen bian liang 。 test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen    hao jie jue le zhe liang ge wen ti , wo men jie xia qu si kao    you shu ru jiu bi ran you shu chu , you yu shu chu han shu he shu ru han shu shi xiang dui du li de , wei le bu duan ce shi cheng xu de zheng que xing hao tiao shi wo men xian xie hao shu chu han shu he main han shu nie de tiao yong , chuang jian han shu wo men xian yue ding hao ming wei create。    wo men xian xie chu ru xia de dai ma : #include <iostream> using namespace std; struct test { char name[10]; float socre; test *next; }; test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen test *create() { return head;// fan hui lian shou zhi zhen } void showl(test *head) { cout<<" lian shou zhi zhen :"<<head<<endl; while(head)// yi nei cun zhi xiang wei null wei tiao jian xun huan xian shi xian qian shu ru de nei rong { cout<<head->name<<""<<head->socre<<endl; head=head->next; } } void main() { showl(create()); cin.get(); cin.get(); }    cheng xu xie dao zhe li , ji ben xing tai yi jing chu lai , shu ru he tiao yong wo men yi jing you le 。    xia mian wo men lai jie jue shu ru wen ti , lian biao de shi xian wo men shi tong guo xun huan shu ru lai shi xian de , ji ran shi xun huan wo men jiu yi ding de kao lv zhong zhi xun huan de tiao jian , bi mian si xun huan he wu xiao xun huan de fa sheng 。 [url=http://www.wangchao.net.cn/bbs/pydetail_1785435.html][img]http://image.wangchao.net.cn/it/1323423374756.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo    zai create() han shu nei bu wo men xian xie cheng zhe yang : test *create() { test *ls;// jie dian zhi zhen test *le;// lian yi zhi zhen ls = new test;// ba ls zhi xiang dong tai kai pi de dui nei cun di zhi cin>>ls->name>>ls->socre; head=NULL;// jin ru de shi hou xian bu she zhi head zhi zhen zhi xiang ren he di zhi , yin wei bu zhi dao shi fou yi shang lai jiu shu ru null tiao chu cheng xu le=ls;// ba lian yi zhi zhen she zhi cheng gang gang dong tai kai pi de dui nei cun di zhi , yong yu deng xia she zhi le->next, ye jiu shi xia yi ge jie dian de wei zhi le->next=NULL;// ba lian yi zhi zhen de next she zhi wei kong , yin wei bu guan ru he xun huan zong shi yao jie shu de , she zhi wei kong cai neng gou zai xun huan xian lian biao de shi hou bu zhi yu si xun huan delete ls;// dang jie shu de shi hou zui hou yi ge dong tai kai pi de nei cun shi wu xiao de , suo yi bi xu qing chu diao return head;// fan hui lian shou zhi zhen }    zai xun huan chuang jian zhi qian wo men bi xu kao lv yi ge dou bu shu ru de qing kuang 。    cheng xu yi dan jin ru create han shu wo men shou xian bi ran yao chuang jian yi ge jie dian , wo men xian chuang jian yi ge jie dian zhi zhen , hou ba zhe ge jie dian zhi zhen zhi xiang dao dong tai kai pi de test lei xing de dong tai nei cun di zhi wei zhi shang 。    suo yi wo men you le test *ls; ls = new test;    cheng xu ji ran shi xun huan shu ru , er jie gou cheng yuan test *next you shi yong lai cun chu xia yi ge jie dian de nei cun di zhi de , mei ci xun huan wo men you yao dong tai chuang jian yi ge xin de nei cun kong jian , suo yi wo men bi xu yao you yi ge zhi zhen lai cun chu shang yi ci xun huan dong tai kai pi de nei cun di zhi , yu shi jiu you le test *le;    jie xia lai zai jin ru xun huan qian wo men yao chuang jian lian biao de di yi ge jie dian , di yi ge jie dian bi ran shi zai xun huan wai chuang jian , yu shi jiu you le cin>>ls->name>>ls->socre;    cheng xu zhi xing zhe de qing kuang shi wei zhi de , suo yi wo men bi ran yao kao lv , yi shang lai jiu bu xiang ji xu yun xing cheng xu de qing kuang , suo yi wo men yi kai shi xian ba head yin dao zhi zhen she zhi wei bu zhi xiang ren he di zhi ye jiu shi head=NULL;    wei le fu he le ye jiu shi lian yi zhi zhen de she ji si lu , wo men zai xun huan qian yi ding yao bao cun gang gang dong tai kai pi de nei cun di zhi , hao zai xia yi ci xun huan de shi hou she zhi shang yi ge jie dian zhong de next cheng yuan zhi xiang , yu shi wo men bian you le : le=ls;    wei le shi xian xun huan shu ru wo men you le xia mian de dai ma : while(strcmp(ls->name,"null")!=0) { if(head==NULL) { head=ls; } else { le->next=ls; } le=ls; ls=new test; cin>>ls->name>>ls->socre; }    cheng xu shi xun huan bi ran yao you zhong zhi xun huan de tiao jian , suo yi wo men de xun huan tiao jian shi : while(strcmp(ls->name,"null")!=0)    shu ru de ming zi shi null de shi hou jiu ting zhi xun huan 。    wei le bao zheng di yi ci jin ru xun huan , ye jiu shi zai xun huan nei yu bei chuang jian di er ge jie dian qian , she zhi yin dao zhi zhen de zhi xiang wo men you le ru xia de pan ding dai ma : if(head==NULL) { head=ls; } else { le->next=ls; } [url=http://www.wangchao.net.cn/bbs/pydetail_1785435.html][img]http://image.wangchao.net.cn/it/1323423374778.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo    dai ma zhong de else tiao jian shi wei le she zhi qian yi ge jie dian next zhi xiang er xie de , zhe dian wo men ji zhu xian kan xia mian de dai ma , shao hou da jia hui guo tou xiang jiu ming bai le le=ls; ls=new test; cin>>ls->name>>ls->socre;   le=ls; zhe me xie jiu shi wei le bao cun shang yi ci xun huan zhi zhen de wei zhi er she de , zheng shi wei le shang mian de else dai ma er zuo de yu xian bao liu ls=new test; cin>>ls->name>>ls->socre;    zhe liang xing dai ma de yi si jiu shi ji xu kai pi xia yi ge jie dian kong jian , he shu ru jie dian nei rong !    xun huan yi dan jie shu ye jiu jie shu le cheng xu , wei le bao chi cheng xu bu chu cuo , ye jiu shi zui hou yi ge jie dian de next cheng yuan zhi xiang wei kong wo men you le xia mian de dai ma le->next=NULL;    cheng xu de si lu shi zhong shi yi xian kai pi hou pan ding wei si lu de , suo yi dao zui hou yi ge bu cheng li de shi hou zong hui you yi ge duo kai pi de nei cun kong jian , wei le shan chu diao ta , wo men you le xia mian de dai ma delete ls;    cheng xu dao zui hou you yu fan hui head zhi zhen return head;    xian shi lian biao de han shu mei you shen me tai duo fei fan de ye zhi xu yao zhu chong xia mian zhe yang jiu ke yi le ! head=head->next;    wo men zhi suo yi bu yong head+=1; lai xie jiu shi yin wei lian biao shi wo men dong tai kai pi de , er mei yi ge jie dian de wei zhi bing bu shi xiang lian de ,next cheng yuan zhi zhen de yi yi ye jiu shi xia yi ge jie dian de nei cun di zhi 。    dao zhe li zheng ge chuang jian han shu de she ji si lu ye dou shuo wan le , bi zhe bu yi ding shuo de hen hao , dan ji ben si lu shi zhe yang de , xi wang du zhe duo si kao , duo dui bi , xiang xin ci jiao cheng huan shi dui da jia you bang zhu de , cheng xu she ji jiu shi li yong zhu bu si kao de fang shi jin xing de , xie hao de dai ma wang wang zhi jie kan kan bu dong jiu shi yin wei zhong jian de xi jie bing bu shi yi ci dou neng gou xiang dao de 。    xia mian wo men lai shuo yi xia lian biao jie dian de shan chu !    wo men yi shang mian de cheng xu wei ji chu , dan wei le wo men fang bian xue xi shan chu wo men xiu zheng jie gou ti wei struct test { int number; float socre; test *next; };   number wei wei yi de bian hao mei yi ge jie dian de 。    shan chu de wo jiu bu duo shuo le , li mian chong yao bu fen you zhu jie 。    fei fan zhu chong deletel han shu de shen shu yi yi , zhi zhen de yin yong zai zhe li hen chong yao , jia ru zhi shi zhi zhen , huo zhe zhi shi ying yong dou shi bu xing de , wei shen me zai xi si kao , hen duo zhi ming de jiao cai zai zhe yi wen ti shang dou hen mo hu , er qie hen duo shu huan you cuo wu , cheng xu bu cuo , dan si lu shi cuo de , wo zhe li fei fan bu shuo , qing da jia zai xi yue du cheng xu , jia ru huan shi you wen ti , ke yi hui ci tie , wo hui hui da de 。 [url=http://www.wangchao.net.cn/bbs/pydetail_1785435.html][img]http://image.wangchao.net.cn/it/1323423374792.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo    wan zheng dai ma ru xia : #include <iostream> using namespace std; struct test { int number; float socre; test *next; }; test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen test *create() { test *ls;// jie dian zhi zhen test *le;// lian yi zhi zhen ls = new test;// ba ls zhi xiang dong tai kai pi de dui nei cun di zhi cin>>ls->number>>ls->socre; head=NULL;// jin ru de shi hou xian bu she zhi head zhi zhen zhi xiang ren he di zhi , yin wei bu zhi dao shi fou yi shang lai jiu shu ru null tiao chu cheng xu le=ls;// ba lian yi zhi zhen she zhi cheng gang gang dong tai kai pi de dui nei cun di zhi , yong yu deng xia she zhi le->next, ye jiu shi xia yi ge jie dian de wei zhi while(ls->number!=0)// chuang jian xun huan tiao jian wei ls->number de zhi bu shi null, yong yu xun huan tian jia jie dian { if(head==NULL)// pan ding shi fou shi di yi ci jin ru xun huan { head=ls;// jia ru shi di yi ci jin ru xun huan , na me ba yin dao jin ru lian biao de zhi zhen zhi xiang di yi ci dong tai kai pi de dui nei cun di zhi } else { le->next=ls;// jia ru bu shi di yi ci jin ru na me jiu ba shang yi ci de lian yi zhi zhen de le->next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi } le=ls;// she zhi lian yi zhi zhen wei dang qian xun huan zhong de jie dian zhi zhen , yong yu xia yi ci jin ru xun huan de shi hou ba shang yi ci de jie dian de next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi ls=new test;// wei xia yi ge jie dian zai dui nei cun zhong dong tai kai pi kong jian cin>>ls->number>>ls->socre; } le->next=NULL;// ba lian yi zhi zhen de next she zhi wei kong , yin wei bu guan ru he xun huan zong shi yao jie shu de , she zhi wei kong cai neng gou zai xun huan xian lian biao de shi hou bu zhi yu si xun huan delete ls;// dang jie shu de shi hou zui hou yi ge dong tai kai pi de nei cun shi wu xiao de , suo yi bi xu qing chu diao return head;// fan hui lian shou zhi zhen } void showl(test *head) { cout<<" lian shou zhi zhen :"<<head<<endl; while(head)// yi nei cun zhi xiang wei null wei tiao jian xun huan xian shi xian qian shu ru de nei rong { cout<<head->number<<""<<head->socre<<endl; head=head->next; } } void deletel(test *&head,int number)// zhe li jia ru shen shu huan cheng test *head, yi yi jiu wan quan bu tong le ,head bian cheng le fu zhi er bu shi yuan you lian shang cao zuo le , fei fan zhu chong , hen duo shu shang dou bu dui zhe li { test *point;// pan ding lian biao shi fou wei kong if(head==NULL) { cout<<" lian biao wei kong , bu neng jin xing shan chu gong zuo !"; return; } if(head->number==number)// pan shan chu de jie dian shi fou wei shou jie dian { point=head; cout<<" shan chu dian shi lian biao di yi ge jie dian wei zhi !"; head=head->next;// chong xin she zhi yin dao zhi zhen delete point; return; } test *fp=head;// bao cun lian shou zhi zhen for(test *&mp=head;mp->next;mp=mp->next) { if(mp->next->number==number) { point=mp->next; mp->next=point->next; delete point; head=fp;// you yu head de bu duan yi dong diu shi le head, ba jin ru xun huan qian de head zhi zhen hui fu ! return; } } } void main() { head=create();// tiao yong chuang jian showl(head); int dp; cin>>dp; deletel(head,dp);// tiao yong shan chu showl(head); cin.get(); cin.get(); } [url=http://www.wangchao.net.cn/bbs/pydetail_1785435.html][img]http://image.wangchao.net.cn/it/1323423374817.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo    zui hou wo xue xi yi xia ru he zai yi you de lian biao shang cha ru jie dian    wo men yao kao lv si zhong qing kuang ,   1. lian biao wei kong !   2. cha ru dian zai shou jie dian qian   3. cha ru dian zhao bu dao de qing kuang wo men she zhi fang zai zui hou !   4. cha ru dian zai zhong jian de qing kuang !    jin tian de cheng xu zai zuo tian de ji chu shang zuo le jin yi bu de xiu gai , ke yi bi mian shan chu dian zhao bu dao de qing kuang , jia ru zhao bu dao shan chu dian jiu tui chu han shu ! #include <iostream> using namespace std; struct test { int number; float socre; test *next; }; test *head;// chuang jian yi ge quan ju de yin dao jin ru lian biao de zhi zhen test *create() { test *ls;// jie dian zhi zhen test *le;// lian yi zhi zhen ls = new test;// ba ls zhi xiang dong tai kai pi de dui nei cun di zhi cout<<" qing shu ru di yi ge jie dian number he jie dian score, shu ru 0.0 tiao chu han shu "<<endl; cin>>ls->number>>ls->socre; head=NULL;// jin ru de shi hou xian bu she zhi head zhi zhen zhi xiang ren he di zhi , yin wei bu zhi dao shi fou yi shang lai jiu shu ru null tiao chu cheng xu le=ls;// ba lian yi zhi zhen she zhi cheng gang gang dong tai kai pi de dui nei cun di zhi , yong yu deng xia she zhi le->next, ye jiu shi xia yi ge jie dian de wei zhi while(ls->number!=0)// chuang jian xun huan tiao jian wei ls->number de zhi bu shi null, yong yu xun huan tian jia jie dian { if(head==NULL)// pan ding shi fou shi di yi ci jin ru xun huan { head=ls;// jia ru shi di yi ci jin ru xun huan , na me ba yin dao jin ru lian biao de zhi zhen zhi xiang di yi ci dong tai kai pi de dui nei cun di zhi } else { le->next=ls;// jia ru bu shi di yi ci jin ru na me jiu ba shang yi ci de lian yi zhi zhen de le->next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi } le=ls;// she zhi lian yi zhi zhen wei dang qian xun huan zhong de jie dian zhi zhen , yong yu xia yi ci jin ru xun huan de shi hou ba shang yi ci de jie dian de next zhi xiang shang yi ci xun huan jie shu qian dong tai chuang jian de dui nei cun di zhi ls=new test;// wei xia yi ge jie dian zai dui nei cun zhong dong tai kai pi kong jian cout<<" qing xia yi ge jie dian number he jie dian score, shu ru 0.0 tiao chu han shu "<<endl; cin>>ls->number>>ls->socre; } le->next=NULL;// ba lian yi zhi zhen de next she zhi wei kong , yin wei bu guan ru he xun huan zong shi yao jie shu de , she zhi wei kong cai neng gou zai xun huan xian lian biao de shi hou bu zhi yu si xun huan delete ls;// dang jie shu de shi hou zui hou yi ge dong tai kai pi de nei cun shi wu xiao de , suo yi bi xu qing chu diao return head;// fan hui lian shou zhi zhen } void showl(test *head) { cout<<" lian shou zhi zhen :"<<head<<endl; while(head)// yi nei cun zhi xiang wei null wei tiao jian xun huan xian shi xian qian shu ru de nei rong { cout<<head->number<<""<<head->socre<<endl; head=head->next; } } void deletel(test *&head,int number)// zhe li jia ru shen shu huan cheng test *head, yi yi jiu wan quan bu tong le ,head bian cheng le fu zhi er bu shi yuan you lian shang cao zuo le , fei fan zhu chong , hen duo shu shang dou bu dui zhe li { test *point;// pan ding lian biao shi fou wei kong if(head==NULL) { cout<<" lian biao wei kong , bu neng jin xing shan chu gong zuo !"; return; } int derror=1;// she zhi zhao bu dao de qing kuang de tiao jian , yu xian she zhi wei zhen test *check=head; while(check)// li yong xun huan jin xing cha zhao { if (check->number==number) { derror=0;// tiao jian zhuan wei jia } check=check->next; } if(derror)// jia ru wei jia jiu tiao chu han shu { return; } if(head->number==number)// pan shan chu de jie dian shi fou wei shou jie dian { point=head; cout<<" shan chu dian shi lian biao di yi ge jie dian wei zhi !"; head=head->next;// chong xin she zhi yin dao zhi zhen delete point; return; } test *fp=head;// bao cun lian shou zhi zhen for(test *&mp=head;mp->next;mp=mp->next) { if(mp->next->number==number) { point=mp->next; mp->next=point->next; delete point; head=fp;// you yu head de bu duan yi dong diu shi le head, ba jin ru xun huan qian de head zhi zhen hui fu ! return; } } } void insterl(int number) { test *point=new test; cout<<" qing shu ru jie dian number he jie dian score"<<endl; cin>>point->number>>point->socre; if(head==NULL)// lian biao wei kong de qing kuang xia cha ru { head=point; point->next=NULL; return; } int ierror=1;// she zhi zhao bu dao de qing kuang de tiao jian , yu xian she zhi wei zhen test *le; test *check=head; while(check)// li yong xun huan jin xing cha zhao { if (check->number==number) { ierror=0;// tiao jian zhuan wei jia } le=check; check=check->next; } if(ierror) { cout<<le->number; le->next=point; point->next=NULL; return; } if(head->number==number)// jian ce shi fou shi zai di yi ge jie dian chu cha ru { point->next=head; head=point; return; } for(test *&mp=head;mp->next;mp=mp->next)// zai lian biao zhong jian cha ru { if(mp->next->number==number) { point->next=mp->next; mp->next=point; return; } } } void main() { head=create();// tiao yong chuang jian showl(head); int dp; cout<<" qing shu ru shan chu dian jia ru zhao bu dao jiu tiao chu han shu "<<endl; cin>>dp; deletel(head,dp);// tiao yong shan chu showl(head); int ip; cout<<" qing shu ru cha ru dian jia ru zhao bu dao jiu zai lian yi tian jia "<<endl; cin>>ip; insterl(ip); showl(head); cin.get(); cin.get(); }    dao ci guan yu jie gou ti de nei rong yi jing quan bu tao lun jie shu , lian biao de jian li shan chu cha ru cao zuo ke yi hen hao de dui qian mian suo xue zhi shi jin xing yi ge zong jie , ta ji kao cha le cheng xu yuan dui nei cun da li jie ( dui nei cun cao zuo 、 zhi zhen cao zuo ) ye kao cha le dui jie gou hua bian cheng ba wo de shu xi cheng xu 。    yi hou de jiao cheng wo men jiang zhe chong lian xi mian xiang dui xiang de bian cheng de xiang guan zhi shi dian 。[url=http://www.wangchao.net.cn/bbs/pydetail_1785435.html][img]http://image.wangchao.net.cn/it/1323423374862.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao zhi shi zhuan ti , huo
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
赏心悦目的模特儿(9)
赏心悦目的模特儿(8)
赏心悦目的模特儿(7)
赏心悦目的模特儿(6)
周六一日游--绿野翠蜂场(一)
骆驼峰
下一站上环
杂乱的几张Danang
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有