?? matrix.h
字號:
#ifndef HEADER_MATRIX
#define HEADER_MATRIX
//template <typename T>
#include <iostream>
using namespace std;
class Matrix
{
private :
int nRow ,nCol ;
public :
int **Array ;
//構造函數
Matrix(int nRow=5 , int nCol=5);
//矩陣相加
bool add( Matrix &ma ,Matrix &mb ,Matrix &mc) ;
//初始化矩陣
void InitializeMatrix( );//Matrix &ma
//矩陣相減
void subtraction(Matrix &ma , Matrix &mb ,Matrix &mc) ;
//矩陣乘法
void multiplication(Matrix &ma , Matrix &mb ,Matrix &mc) ;
//獲取矩陣的行數
int getRow() ;
//獲取矩陣的列數
int getCol() ;
//重載符號"<<", 輸出矩陣
friend std::ostream & operator<<(std::ostream &o, Matrix &ma )//
{
int nRow = ma.getRow() ;
int nCol = ma.getCol() ;
for(int i = 0 ; i < nRow ; i++)
{
for(int j = 0; j <nCol ;j++)
o << ma.Array[i][j] <<" ";
cout<<endl;
}
return o ;
}
//求矩陣均值
//average(
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -