摘要: Task 3 task3_1.cpp 1 #include<iostream> 2 #include<fstream> 3 #include<array> 4 #define N 5 5 6 int main() { 7 using namespace std; 8 9 array<int, N> 阅读全文
posted @ 2022-12-05 21:25 Weslie_xyy 阅读(30) 评论(0) 推荐(0) 编辑
摘要: Task 4: pets.hpp 1 #pragma once 2 #include<iostream> 3 #include<string> 4 5 using namespace std; 6 7 //机器宠物(+猫、狗)定义 8 class MachinePets { 9 public: 10 阅读全文
posted @ 2022-11-27 11:47 Weslie_xyy 阅读(28) 评论(0) 推荐(0) 编辑
摘要: Task1~4 浅复制:int a = 10; int b = a; 可用于静态内存的复制。对于简单的类,默认的复制构造函数已经够用了,但当类持有其他资源,如动态分配的内存、指针等,就需要用到深复制。 深复制:分配动态内存,再将原有对象的内存复制过来。原有对象和新对象所持有的动态内存是相互独立的。 阅读全文
posted @ 2022-11-08 19:46 Weslie_xyy 阅读(20) 评论(0) 推荐(0) 编辑
摘要: Task5 info.hpp 1 #pragma once 2 #include<iostream> 3 #include<string> 4 5 using namespace std; 6 7 class Info { 8 public: 9 Info(string nn, string con 阅读全文
posted @ 2022-10-26 09:31 Weslie_xyy 阅读(10) 评论(0) 推荐(0) 编辑
摘要: Task4: Complex.hpp 1 #pragma once 2 3 //Complex类的定义 4 #include<iostream> 5 #include<string> 6 #include<math.h> 7 8 using std::cout; 9 using std::endl; 阅读全文
posted @ 2022-10-19 09:34 Weslie_xyy 阅读(25) 评论(0) 推荐(0) 编辑
摘要: task2 1 #include<iostream> 2 using std::cout; 3 using std::endl; 4 5 class Point{ 6 public: 7 Point(int x0 = 0, int y0 = 0); //构造函数 8 Point(const Poin 阅读全文
posted @ 2022-09-30 08:05 Weslie_xyy 阅读(39) 评论(0) 推荐(0) 编辑
摘要: : ) 欢迎来到这里。望共同进步! #include<iostream> int main() { using namespace std; cout << "Welcome to my blogs!" << endl; cout << "Here is my address. <( ̄︶ ̄)↗[GO 阅读全文
posted @ 2022-09-26 08:56 Weslie_xyy 阅读(38) 评论(0) 推荐(0) 编辑