婷婷色中文在线视频,思思热在线视频日本一区,欧美精品一区三区在线观看,日本色逼影音资源

  • <dfn id="pbiqm"><cite id="pbiqm"></cite></dfn>
        
        

        中南大學(xué)c++實(shí)踐報(bào)告

        發(fā)布時(shí)間:2017-07-12  編輯:沈舒文 手機(jī)版

          book(string b_id,string b_n,string au,string pu,double pr);

          void display();

          string getbook_ID();

          string getbook_name();

          string getauther();

          string getpublishing();

          double getprice();

          };

          book::book(string b_id,string b_n,string au,string pu,double pr)

          {

          book_ID=b_id;

          book_name=b_n;

          auther=au;

          publishing=pu;

          price=pr;

          }

          book::book()

          {

          book_ID="";

          book_name="";

          auther="";

          publishing="";

          price=0;

          }

          void book::display()

          {

          cout<<"書(shū)號(hào):"<

          cout<<"書(shū)名:"<

          cout<<"作者:"<

          cout<<"出版社:"<

          cout<<"定價(jià):"<

          }

          string book::getbook_ID()

          {return book_ID;}

          string book::getbook_name()

          {return book_name;}

          string book::getauther()

          {return auther;}

          string book::getpublishing()

          {return publishing;}

          double book::getprice()

          {return price;}

          //book.h 結(jié)束

          //strclass.h 文件結(jié)束

          #include "string.h"

          class string

          {

          friend ostream& operator<<(ostream& S,const string& Str);

          friend istream& operator>>(istream& S,string& Str);

          public:

          string();

          string(const string& Str);

          void operator=(const string& Str);

          ~string();

          string(char * p);

          private:

          short m_Length;

          char * m_Data;

          };

          string::string()

          {

          m_Length=1;

          m_Data=new char [m_Length];

          memcpy(m_Data,"",m_Length);

          };

          string::string(const string& Str)

          {

          m_Length=Str.m_Length;

          m_Data=new char [m_Length];

          memcpy(m_Data,Str.m_Data,m_Length);

          };

          string::string(char *p)

          {

          m_Length=strlen(p)+1;

          m_Data=new char[m_Length];

          memcpy(m_Data,p,m_Length);

          };

          void string::operator=(const string& Str)

          {

          if(&Str!=this)

          {

          delete [] m_Data;

          m_Length=Str.m_Length;

          m_Data=new char [m_Length];

          memcpy(m_Data,Str.m_Data,m_Length);

          }

          return;

          };

          string::~string()

          {delete [] m_Data;};

          ostream& operator<<(ostream& S,const string& Str)

          {

          short i;

          for(i=0;i

          S << Str.m_Data[i];

          return S;

          };

          istream& operator >> (istream& S,string& Str)

          {

          const short BUFLEN=256;

          char Buf[BUFLEN];

          memset(Buf,0,BUFLEN);

          if(S.peek()=='\n')

          S.ignore();

          S.getline(Buf,BUFLEN,'\n');

          Str=Buf;

          return S;

          };

          //strclass.h結(jié)束

          //buy_book.cpp開(kāi)始

          #include

          #include "strclass.h"

          #include "buyer.h"

          #include "book.h"

          void main()

          {

          int i=0,buyerid,flag;

          book *c[2];

          layfolk b1("王林",1,"武漢",0);

          honoured_guest b2("張麗",2,.6,"長(zhǎng)沙",0); //

          member b3("張強(qiáng)",3,5,"廣州",0);

          buyer *b[3]={&b1,&b2,&b3};

          book c1("7-302-04504-6","計(jì)算機(jī)二級(jí)輔導(dǎo)","張林","清華",25);

          book c2("7-402-03388-9"," 數(shù)據(jù)結(jié)構(gòu)","許桌群","北大",20);

          c[0]=&c1;

          c[1]=&c2;

          cout<<"購(gòu)書(shū)人信息:\n\n";

          for(i=0;i<3;i++)

          b[i]->display();

          cout<<"\n圖書(shū)信息:\n\n";

          for(i=0;i<2;i++)

          c[i]->display();

          cout<<"\n\n請(qǐng)輸入購(gòu)書(shū)人編號(hào):";

          cin>>buyerid;

          flag=0;

          for(i=0;i<3;i++)

          if(b[i]->getid()==buyerid){flag=1;break;}

          if(!flag){cout<<"編號(hào)不存在"<

          else

          {

          b[i]->setpay(c[0]->getprice());

          b[i]->setpay(c[1]->getprice());

          cout<getpay()<<"\n\n";

          }

          }

          //buy_book.cpp文件結(jié)束

          運(yùn)行結(jié)果如下:

          實(shí)訓(xùn)心得:

          轉(zhuǎn)眼,C++一周的實(shí)訓(xùn)已經(jīng)結(jié)束了,在這一周的過(guò)程中,通過(guò)上機(jī)練習(xí)C++編程,深切的體會(huì)到了編程的樂(lè)趣,在做題的過(guò)程中,不僅提高了我動(dòng)手實(shí)踐的能力,我懂得了它不是一個(gè)人的任務(wù),是大家共同努力的結(jié)果。

          不過(guò)我也真正的認(rèn)識(shí)到,要學(xué)好C++理論是基本,要想更好的,更快的有所突破還是要通過(guò)上機(jī)練習(xí)。

          在此次實(shí)訓(xùn)中,我也看到了許多自己的不足,不僅是知識(shí)上的,還有思考能力等都需要提高,再編程過(guò)程中,思維是占主要的。所以不斷的編程,是提高自己能力的途徑。

          在此更要感謝老師對(duì)我們的孜孜不倦的教導(dǎo)!


        123

        最熱文章榜Hot  Top