From aae4fe2f2602fedb24dc8222fd426cd50cb14152 Mon Sep 17 00:00:00 2001 From: iridiumR Date: Sat, 12 Mar 2022 14:14:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoftwareDesign/Code/1-1c/main.cpp | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 SoftwareDesign/Code/1-1c/main.cpp diff --git a/SoftwareDesign/Code/1-1c/main.cpp b/SoftwareDesign/Code/1-1c/main.cpp new file mode 100644 index 0000000..5cc49ec --- /dev/null +++ b/SoftwareDesign/Code/1-1c/main.cpp @@ -0,0 +1,42 @@ +/* + * @Author: iR + * @Date: 2022-03-11 20:22:54 + * @LastEditors: iR + * @LastEditTime: 2022-03-12 14:13:14 + * @FilePath: \Code\1-1c\main.cpp + * @Description: + * + * Copyright (c) 2022 by iR, All Rights Reserved. + */ + +#include "../inc/matrix.hpp" +#include +int main() +{ + double data[] = {1, 2, 3, 4}; + Matrix a(2, 2, data); + std::cout << "a" << std::endl + << a.at(0, 0) << " " << a.at(1, 0) << std::endl + << a.at(0, 1) << " " << a.at(1, 1) << std::endl; + std::cout << "+=" << std::endl; + + Matrix b(2, 2, data); + std::cout << "b" << std::endl + << b.at(0, 0) << " " << b.at(1, 0) << std::endl + << b.at(0, 1) << " " << b.at(1, 1) << std::endl; + std::cout << "Answer" << std::endl; + + a += b; + std::cout << "a" << std::endl + << a.at(0, 0) << " " << a.at(1, 0) << std::endl + << a.at(0, 1) << " " << a.at(1, 1) << std::endl; + + std::cout << "c=a+b" << std::endl; + Matrix c = a + b; + std::cout << "Answer" << std::endl; + std::cout << "c" << std::endl + << c.at(0, 0) << " " << c.at(1, 0) << std::endl + << c.at(0, 1) << " " << c.at(1, 1) << std::endl; + + return 0; +}