寡妇张开腿让黑人通爽,吃瓜黑料,欧美激情内射喷水高潮,亚洲精品午夜国产va久久成人

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

發(fā)布時間: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<<"書號:"<

  cout<<"書名:"<

  cout<<"作者:"<

  cout<<"出版社:"<

  cout<<"定價:"<

  }

  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開始

  #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,"長沙",0); //

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

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

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

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

  c[0]=&c1;

  c[1]=&c2;

  cout<<"購書人信息:\n\n";

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

  b[i]->display();

  cout<<"\n圖書信息:\n\n";

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

  c[i]->display();

  cout<<"\n\n請輸入購書人編號:";

  cin>>buyerid;

  flag=0;

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

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

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

  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é)束了,在這一周的過程中,通過上機(jī)練習(xí)C++編程,深切的體會到了編程的樂趣,在做題的過程中,不僅提高了我動手實(shí)踐的能力,我懂得了它不是一個人的任務(wù),是大家共同努力的結(jié)果。

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

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

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


123
相關(guān)推薦

最熱文章榜Hot  Top

安义县| 扎兰屯市| 郴州市| 建昌县| 滕州市| 开平市| 泸定县| 亚东县| 武夷山市| 锦州市| 浮山县| 闵行区| 嘉黎县| 壤塘县| 潍坊市| 廊坊市| 平塘县| 吉水县| 都江堰市| 孟州市| 新闻| 雅江县| 海兴县| 凌云县| 长乐市| 阳泉市| 台北县| 龙海市| 界首市| 登封市| 宁强县| 缙云县| 井冈山市| 疏附县| 无棣县| 西峡县| 区。| 镇原县| 新乡市| 米易县| 罗江县|