【】Chapter数组和矩阵.pptVIP

  • 0
  • 0
  • 约1.02万字
  • 约 50页
  • 2017-08-22 发布于江苏
  • 举报
【】Chapter数组和矩阵

(插入操作符):二元操作符 coutHello!\n; 操作数1:输出流 操作数2:字符串 Money amount(100); amount.output(cout); int amount(100); coutamount; coutamount; 重载操作符 重载和 课后练习(课下自行完成) Page136:练习1 (2)2维数组类 二维数组的构造 templateclass T Array2DT::Array2D(int r,int c) { if(r0||c0) throw BadInitializers( ); if((!r||!c)(r||c) throw BadInitializers( ); rows=r; cols=c; row=new Array1DT[r]; for(int i=0;ir; i++) row[i].Resize(c); //调整每个元素的大小 } templateclass T void Array1DT::ReSize(int sz) { delete[ ] element; size=sz; element=new T[size]; } 二维数组的复制构造 templateclass T Array2DT::Array2D(const Arr

文档评论(0)

1亿VIP精品文档

相关文档