摘要: 四、实验结论 1.实验任务4 Vector.hpp #pragma once #include <iostream> #include <stdexcept> using namespace std; template <typename T> class Vector { private: T* 阅读全文
posted @ 2023-12-17 18:38 夏添添 阅读(53) 评论(0) 推荐(0)
摘要: 四、实验结论 实验任务3 pets.hpp #pragma once #include<iostream> #include<string> using namespace std; class MachinePets { public: MachinePets(const string &s = 阅读全文
posted @ 2023-12-03 17:19 夏添添 阅读(47) 评论(0) 推荐(0)
摘要: 四、实验内容 1.实验任务1 //在C++中定义和使用类模板 task1_1.cpp #include <iostream> using namespace std; // 类A的定义 class A{ public: A(int x0, int y0): x{ x0 }, y{ y0 } {} v 阅读全文
posted @ 2023-11-30 19:20 夏添添 阅读(63) 评论(0) 推荐(0)
摘要: 1、实验任务1 源码Point.hpp #pragma once #include <iostream> using std::cout; using std::endl; class Point { public: Point(int x0 = 0, int y0 = 0); ~Point() = 阅读全文
posted @ 2023-11-05 21:28 夏添添 阅读(24) 评论(0) 推荐(1)
摘要: 1.实验任务3 程序代码组织如下: •Complex.h 类Complex的声明 #pragma once # include<iostream> # include<cmath> class Complex{ public: Complex(double r = 0, double i = 0); 阅读全文
posted @ 2023-10-22 19:26 夏添添 阅读(22) 评论(0) 推荐(0)
摘要: 1.实验任务1 task.1 程序代码: # include<iostream> # include<string> # include<vector> # include <array> template <typename T> void output1(const T &obj){ for(a 阅读全文
posted @ 2023-10-19 18:52 夏添添 阅读(34) 评论(0) 推荐(1)