旧代码
This commit is contained in:
parent
54794027da
commit
62a5e91530
4 changed files with 45 additions and 2 deletions
|
@ -40,4 +40,5 @@ int main()
|
|||
<< c.at(0, 1) << " " << c.at(1, 1) << " " << c.at(2, 1) << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
15
SoftwareDesign/Code/1-3b/main.cpp
Normal file
15
SoftwareDesign/Code/1-3b/main.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <iostream>
|
||||
#include "../inc/matrix.hpp"
|
||||
|
||||
void print_element(const MatBase<double> &m, int x, int y)
|
||||
{ // 注意参数是基类
|
||||
std::cout << m.at(x, y) << std::endl; // 调用虚函数所定义的接口
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Matrix<double> a(2, 2, 9.0);
|
||||
Matrix<double> b(2, 2, 7.0);
|
||||
print_element(a, 0, 0); // 输出 Mat2x2 变量 a 的第一个元素,注意输入是派生类
|
||||
print_element(b, 0, 0); // 输出 Matrix 变量 b 的第一个元素,注意输入是派生类
|
||||
}
|
0
SoftwareDesign/Code/2-1/.gitignore
vendored
0
SoftwareDesign/Code/2-1/.gitignore
vendored
|
@ -46,7 +46,34 @@
|
|||
"ostream": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"ctime": "cpp",
|
||||
"iomanip": "cpp"
|
||||
"iomanip": "cpp",
|
||||
"bit": "cpp",
|
||||
"chrono": "cpp",
|
||||
"codecvt": "cpp",
|
||||
"compare": "cpp",
|
||||
"complex": "cpp",
|
||||
"concepts": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"cstring": "cpp",
|
||||
"list": "cpp",
|
||||
"map": "cpp",
|
||||
"set": "cpp",
|
||||
"unordered_set": "cpp",
|
||||
"functional": "cpp",
|
||||
"iterator": "cpp",
|
||||
"numeric": "cpp",
|
||||
"random": "cpp",
|
||||
"ratio": "cpp",
|
||||
"source_location": "cpp",
|
||||
"future": "cpp",
|
||||
"mutex": "cpp",
|
||||
"numbers": "cpp",
|
||||
"semaphore": "cpp",
|
||||
"stop_token": "cpp",
|
||||
"thread": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"valarray": "cpp",
|
||||
"variant": "cpp"
|
||||
},
|
||||
"commentTranslate.hover.enabled": true
|
||||
}
|
||||
|
|
Reference in a new issue