改文件夹

This commit is contained in:
iridiumR 2022-03-12 17:28:55 +08:00
parent 88f7d7107f
commit c0570d6768

View file

@ -0,0 +1,43 @@
/*
* @Author: iR
* @Date: 2022-03-12 14:46:07
* @LastEditors: iR
* @LastEditTime: 2022-03-12 17:13:51
* @FilePath: \Code\1-2a\main.cpp
* @Description:
* @custom_string_iR_Mail: Mail: i@iridium.cyou
* @custom_string_iR_copyright: Copyright (c) ${now_year} by iR, All Rights Reserved.
*/
#include "../inc/matrix.hpp"
#include <stdio.h>
int main()
{
double data[] = {1, 2, 3, 4, 5, 6};
Matrix<double> a(3, 2, data);
std::cout << "a" << std::endl
<< a.at(0, 0) << " " << a.at(1, 0) << a.at(2, 0) << std::endl
<< a.at(0, 1) << " " << a.at(1, 1) << a.at(2, 2) << std::endl;
std::cout << "+=" << std::endl;
Matrix<double> b(3, 2, data);
std::cout << "b" << std::endl
<< b.at(0, 0) << " " << b.at(1, 0) << b.at(2, 0) << std::endl
<< b.at(0, 1) << " " << b.at(1, 1) << b.at(2, 2) << std::endl;
std::cout << "Answer" << std::endl;
a += b;
std::cout << "a" << std::endl
<< a.at(0, 0) << " " << a.at(1, 0) << a.at(2, 0) << std::endl
<< a.at(0, 1) << " " << a.at(1, 1) << a.at(2, 2) << std::endl;
std::cout << "c=a+b" << std::endl;
Matrix<double> c = a + b;
std::cout << "Answer" << std::endl;
std::cout << "c" << std::endl
<< c.at(0, 0) << " " << c.at(1, 0) << a.at(2, 0) << std::endl
<< c.at(0, 1) << " " << c.at(1, 1) << a.at(2, 0) << std::endl;
return 0;
}