4-5
来源:互联网 发布:js 设置一秒后 编辑:程序博客网 时间:2024/04/30 00:52
#include <iostream.h>class Matrix{public:Matrix();friend Matrix operator +(Matrix &,Matrix &);friend istream& operator >>(istream &,Matrix &);friend ostream& operator <<(ostream &,Matrix &);private:int mat[2][3];};Matrix::Matrix(){ for(int i=0;i<2;i++) for(int j=0;j<3;j++) mat[i][j]=0;}Matrix operator +(Matrix &a,Matrix &b){ Matrix c; for(int i=0;i<2;i++) for(int j=0;j<3;j++) c.mat[i][j]=a.mat[i][j]+b.mat[i][j]; return c;}istream & operator >>(istream & in,Matrix &c){ for(int i=0;i<2;i++) for(int j=0;j<3;j++) in>>c.mat[i][j]; return in;}ostream & operator <<(ostream & out,Matrix &c){ for(int i=0;i<2;i++) for(int j=0;j<3;j++) { out<<c.mat[i][j]<<" "; cout<<endl; } return out;}int main(){ Matrix a,b,c; cin>>a; cout<<a; cin>>b; cout<<b; c=a+b; cout<<c; return 0;}
0 0
- 5/4
- 4-5
- 4-5
- 5-4
- 4-5
- 5-4
- 5- 4
- 5-4
- 4、5
- 5-1 ~ 5-4
- 练习5-3&&5-4&&5-5
- 5-4 后天 (5分)
- 例4-5,4-6
- 练习5-4
- [Lab Week] 4->5
- jdk1.4 & jdk1.5
- 2009-4-5
- 程序5-4 Bezier
- 如何理解离散傅里叶变换(一)实数形式傅里叶变换
- maven创建servlet3.0的web工程
- apply方法 Scala学习笔记-面向对象篇
- iOS 如何配置新建Xocde工程,识别C++语言混编
- ural 1057
- 4-5
- 编译器错误信息: CS0016: 未能写入输出文件“d:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\5177u
- java多线程系列----------- 基本的线程机制(一)
- 2015实习生求职季总结
- mysql中常用的三种插入数据的语句
- android布局属性之margin
- EIT造型的理解及android NDK开发demo
- UI_Button(按钮)
- ArcSDE之SDE命令