摘要: 实验任务4 #pragma once #include <iostream> #include <stdexcept> using std::cout; using std::endl; template <typename T> class Vector { public: // 构造函数,默认大 阅读全文
posted @ 2023-12-17 21:48 小程夏天 阅读(18) 评论(0) 推荐(0)
摘要: 实验任务三 #include <iostream> #include <string> #pragma once using namespace std; class MachinePets { private: string nickname; public: MachinePets(const 阅读全文
posted @ 2023-12-03 21:29 小程夏天 阅读(41) 评论(0) 推荐(0)
摘要: 1.普通数组、array、vector的相关性,以及,区别 相关性 存储多个元素:1. 普通数组: 使用 C 风格数组声明和定义,大小固定。2. array: 是 C++11 引入的标准库容器,提供了数组的替代,大小固定。3. vector: 是 C++ 标准库中的动态数组,大小可以动态调整。 元素 阅读全文
posted @ 2023-11-30 22:51 小程夏天 阅读(57) 评论(0) 推荐(0)
摘要: 第一个任务 #pragma once #include <iostream> using std::cout; using std::endl; class Point { public: Point(int x0 = 0, int y0 = 0); ~Point() = default; int 阅读全文
posted @ 2023-11-05 21:33 小程夏天 阅读(34) 评论(0) 推荐(0)
摘要: //第一个任务简单Complex类#pragma once #include <iostream> #include <cmath> class Complex { public: Complex(double x0 = 0, double y0 = 0); // 构造函数 Complex(cons 阅读全文
posted @ 2023-10-22 20:54 小程夏天 阅读(27) 评论(0) 推荐(0)
摘要: #include <iostream> #include <string> #include <vector> #include <array> // 通用函数(此处是模板函数)用于输出容器中的元素,支持范围for(范围for循环,是一种用于遍历容器、数组和其他序列容器的现代C++迭代循环结构。它提 阅读全文
posted @ 2023-10-19 21:23 小程夏天 阅读(49) 评论(0) 推荐(0)