This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/SoftwareDesign/Lab1/1-2/main.cpp

45 lines
1.5 KiB
C++
Raw Permalink Normal View History

2022-03-12 09:28:55 +00:00
/*
* @Author: iR
* @Date: 2022-03-12 14:46:07
* @LastEditors: iR
2022-03-14 23:21:48 +00:00
* @LastEditTime: 2022-03-15 07:17:38
* @FilePath: \Code\1-2\main.cpp
2022-03-12 09:28:55 +00:00
* @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
2022-03-14 23:21:48 +00:00
<< 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, 1) << std::endl;
2022-03-12 09:28:55 +00:00
std::cout << "+=" << std::endl;
Matrix<double> b(3, 2, data);
std::cout << "b" << std::endl
2022-03-14 23:21:48 +00:00
<< 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, 1) << std::endl;
2022-03-12 09:28:55 +00:00
std::cout << "Answer" << std::endl;
a += b;
std::cout << "a" << std::endl
2022-03-14 23:21:48 +00:00
<< 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, 1) << std::endl;
2022-03-12 09:28:55 +00:00
std::cout << "c=a+b" << std::endl;
Matrix<double> c = a + b;
std::cout << "Answer" << std::endl;
std::cout << "c" << std::endl
2022-03-14 23:21:48 +00:00
<< c.at(0, 0) << " " << c.at(1, 0) << " " << c.at(2, 0) << std::endl
<< c.at(0, 1) << " " << c.at(1, 1) << " " << c.at(2, 1) << std::endl;
2022-03-12 09:28:55 +00:00
return 0;
2022-03-29 05:29:00 +00:00
}