幼稚园接悟空 2015-12-04 13:30 采纳率: 100%
浏览 1509
已采纳

请问调用时候参数写什么?求助大神!我是个小白!

class Matrix:public MATRIX
{
public:
Matrix():MATRIX(){}
Matrix( int c, int r ):MATRIX(c,r){}
Matrix( const Matrix& m){ *this = m; }

const Matrix& operator+=( const Matrix& m );
const Matrix& operator-=( const Matrix& m );
const Matrix& operator*=( const Matrix& m );
const Matrix& operator/=( const Matrix& m );

};

bool operator==( const Matrix& lhs, const Matrix& rhs ); // 重载操作符==
bool operator!=( const Matrix& lhs, const Matrix& rhs ); // 重载操作符!=
const Matrix operator+( const Matrix& lhs, const Matrix& rhs ); // 重载操作符+
const Matrix operator-( const Matrix& lhs, const Matrix& rhs ); // 重载操作符-
const Matrix operator*( const Matrix& lhs, const Matrix& rhs ); // 重载操作符*
const Matrix operator/( const Matrix& lhs, const Matrix& rhs ); // 重载操作符/
const double det( const Matrix& m ); // 计算行列式
const double det( const Matrix& m, int start, int end ); // 计算子矩阵行列式
const Matrix abs( const Matrix& m ); // 计算所有元素的绝对值
const double max( const Matrix& m ); // 所有元素的最大值
const double max( const Matrix& m, int& row, int& col); // 所有元素中的最大值及其下标
const double min( const Matrix& m ); // 所有元素的最小值
const double min( const Matrix& m, int& row, int& col); // 所有元素的最小值及其下标
const Matrix trans( const Matrix& m ); // 返回转置矩阵
const Matrix submatrix(const Matrix& m,int rb,int re,int cb,int ce); // 返回子矩阵
const Matrix inverse( const Matrix& m ); // 计算逆矩阵
const Matrix LU( const Matrix& m ); // 计算方阵的LU分解
const Matrix readMatrix( istream& in = std::cin ); // 从指定输入流读入矩阵
const Matrix readMatrix( string file ); // 从文本文件读入矩阵
const Matrix loadMatrix( string file ); // 从二进制文件读取矩阵
void printMatrix( const Matrix& m, ostream& out = std::cout ); // 从指定输出流打印矩阵
void printMatrix( const Matrix& m, string file); // 将矩阵输出到文本文件
void saveMatrix( const Matrix& m, string file); // 将矩阵保存为二进制文件

#endif
这是.h文件我想在另一个.cpp文件中调用const Matrix readMatrix( istream& in = std::cin ); 这个函数,不知道怎么写?麻烦大神帮我一下,我真是个小白。。

  • 写回答

2条回答 默认 最新

  • ysuwood 2015-12-04 13:45
    关注

    试试:

     void main()
    {
        Matrix a;
        a=readMatrix();
    }
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?