实验2 现代C++编程初体验

news/2025/10/22 22:06:33/文章来源:https://www.cnblogs.com/nanfangzhimu/p/19159086

任务一:

 1 #pragma once
 2 
 3 #include <string>
 4 
 5 // 类T: 声明
 6 class T {
 7 // 对象属性、方法
 8 public:
 9     T(int x = 0, int y = 0);   // 普通构造函数
10     T(const T &t);  // 复制构造函数
11     T(T &&t);       // 移动构造函数
12     ~T();           // 析构函数
13 
14     void adjust(int ratio);      // 按系数成倍调整数据
15     void display() const;           // 以(m1, m2)形式显示T类对象信息
16 
17 private:
18     int m1, m2;
19 
20 // 类属性、方法
21 public:
22     static int get_cnt();          // 显示当前T类对象总数
23 
24 public:
25     static const std::string doc;       // 类T的描述信息
26     static const int max_cnt;           // 类T对象上限
27 
28 private:
29     static int cnt;         // 当前T类对象数目
30 
31 // 类T友元函数声明
32     friend void func();
33 };
34 
35 // 普通函数声明
36 void func();
 1 #include "T.h"
 2 #include <iostream>
 3 #include <string>
 4 
 5 // 类T实现
 6 
 7 // static成员数据类外初始化
 8 const std::string T::doc{"a simple class sample"};
 9 const int T::max_cnt = 999;
10 int T::cnt = 0;
11 
12 // 类方法
13 int T::get_cnt() {
14    return cnt;
15 }
16 
17 // 对象方法
18 T::T(int x, int y): m1{x}, m2{y} { 
19     ++cnt; 
20     std::cout << "T constructor called.\n";
21 } 
22 
23 T::T(const T &t): m1{t.m1}, m2{t.m2} {
24     ++cnt;
25     std::cout << "T copy constructor called.\n";
26 }
27 
28 T::T(T &&t): m1{t.m1}, m2{t.m2} {
29     ++cnt;
30     std::cout << "T move constructor called.\n";
31 }    
32 
33 T::~T() {
34     --cnt;
35     std::cout << "T destructor called.\n";
36 }           
37 
38 void T::adjust(int ratio) {
39     m1 *= ratio;
40     m2 *= ratio;
41 }    
42 
43 void T::display() const {
44     std::cout << "(" << m1 << ", " << m2 << ")" ;
45 }     
46 
47 // 普通函数实现
48 void func() {
49     T t5(42);
50     t5.m2 = 2049;
51     std::cout << "t5 = "; t5.display(); std::cout << '\n';
52 }
 1 #include "T.h"
 2 #include <iostream>
 3 
 4 void test_T();
 5 
 6 int main() {
 7     std::cout << "test Class T: \n";
 8     test_T();
 9 
10     std::cout << "\ntest friend func: \n";
11     func();
12 }
13 
14 void test_T() {
15     using std::cout;
16     using std::endl;
17 
18     cout << "T info: " << T::doc << endl;
19     cout << "T objects'max count: " << T::max_cnt << endl;
20     cout << "T objects'current count: " << T::get_cnt() << endl << endl;
21 
22     T t1;
23     cout << "t1 = "; t1.display(); cout << endl;
24 
25     T t2(3, 4);
26     cout << "t2 = "; t2.display(); cout << endl;
27 
28     T t3(t2);
29     t3.adjust(2);
30     cout << "t3 = "; t3.display(); cout << endl;
31 
32     T t4(std::move(t2));
33     cout << "t4 = "; t4.display(); cout << endl;
34 
35     cout << "test: T objects'current count: " << T::get_cnt() << endl;
36 }

运行结果:

屏幕截图 2025-10-22 091219

 

问题1:不能屏幕截图 2025-10-22 091448

从编译错误信息可知,在 main 函数中调用 funcT() 时,该函数未被声明。

 

问题2:

普通构造函数:

作用:创建T类的新对象,使用参数x和y初始化对象的成员,变量参数有默认值,可以作为默认构造函数使用

调用时机:创建对象时

复制构造函数:

作用:通过已有对象创建新对象的副本,保证新对象与源对象有相同的数据但独立的内存

调用时机:对象初始化,函数参数按值传递,函数返回对象值时

移动构造函数:

作用:从临时对象或即将销毁的对象"窃取"资源,将源对象的资源所有权转移给新对象

调用时机:使用std::move时

析构函数:

作用:清理对象占用的资源,释放动态分配的内存

调用时机:对象离开作用域时

 

问题3:不能

屏幕截图 2025-10-22 092557

编译报错显示 T::get_cnt() 存在多重定义,这是因为该函数的定义被放置在了头文件(或被多个源文件包含的位置)。

任务二:

Complex.cpp

 1 #include "Complex.h"
 2 #include <cmath>
 3 #include <iostream>
 4 
 5 using namespace std;
 6 
 7 // 静态成员初始化
 8 const string Complex::doc = "a simplified Complex class";
 9 
10 // 构造函数实现
11 Complex::Complex() : real(0.0), imag(0.0) {}
12 
13 Complex::Complex(double r) : real(r), imag(0.0) {}
14 
15 Complex::Complex(double r, double i) : real(r), imag(i) {}
16 
17 Complex::Complex(const Complex& other) : real(other.real), imag(other.imag) {}
18 
19 // 成员函数实现
20 double Complex::get_real() const {
21     return real;
22 }
23 
24 double Complex::get_imag() const {
25     return imag;
26 }
27 
28 void Complex::add(const Complex& other) {
29     real += other.real;
30     imag += other.imag;
31 }
32 
33 // 全局函数实现
34 void output(const Complex& c) {
35     cout << c.get_real();
36     if (c.get_imag() >= 0) {
37         cout << " + " << c.get_imag() << "i";
38     } else {
39         cout << " - " << -c.get_imag() << "i";
40     }
41 }
42 
43 double abs(const Complex& c) {
44     return sqrt(c.get_real() * c.get_real() + c.get_imag() * c.get_imag());
45 }
46 
47 Complex add(const Complex& c1, const Complex& c2) {
48     return Complex(c1.get_real() + c2.get_real(), c1.get_imag() + c2.get_imag());
49 }
50 
51 bool is_equal(const Complex& c1, const Complex& c2) {
52     return (c1.get_real() == c2.get_real()) && (c1.get_imag() == c2.get_imag());
53 }
54 
55 bool is_not_equal(const Complex& c1, const Complex& c2) {
56     return !is_equal(c1, c2);
57 }

Complex.h

 1 #ifndef COMPLEX_H
 2 #define COMPLEX_H
 3 
 4 #include <string>
 5 
 6 class Complex {
 7 private:
 8     double real;
 9     double imag;
10 
11 public:
12     static const std::string doc;
13     
14     // 构造函数
15     Complex();
16     Complex(double r);
17     Complex(double r, double i);
18     Complex(const Complex& other);
19     
20     // 获取实部和虚部
21     double get_real() const;
22     double get_imag() const;
23     
24     // 复数加法
25     void add(const Complex& other);
26 };
27 
28 // 全局函数声明
29 void output(const Complex& c);
30 double abs(const Complex& c);
31 Complex add(const Complex& c1, const Complex& c2);
32 bool is_equal(const Complex& c1, const Complex& c2);
33 bool is_not_equal(const Complex& c1, const Complex& c2);
34 
35 #endif

task2.cpp

 1 #include "Complex.h"
 2 #include <iostream>
 3 #include <iomanip>
 4 #include <complex>
 5 
 6 using namespace std;
 7 
 8 void test_Complex();
 9 void test_std_complex();
10 
11 int main() {
12     cout << "*******测试1: 自定义类Complex*******\n";
13     test_Complex();
14     cout << "\n*******测试2: 标准库模板类complex*******\n";
15     test_std_complex();
16     return 0;
17 }
18 
19 void test_Complex() {
20     using std::cout;
21     using std::endl;
22     using std::boolalpha;
23     
24     cout << "类成员测试: " << endl;
25     cout << Complex::doc << endl << endl;
26     
27     cout << "Complex对象测试: " << endl;
28     Complex c1;
29     Complex c2(3, -4);
30     Complex c3(c2);
31     Complex c4 = c2;
32     const Complex c5(3.5);
33     
34     cout << "c1 = "; output(c1); cout << endl;
35     cout << "c2 = "; output(c2); cout << endl;
36     cout << "c3 = "; output(c3); cout << endl;
37     cout << "c4 = "; output(c4); cout << endl;
38     cout << "c5.real = " << c5.get_real() 
39          << ", c5.imag = " << c5.get_imag() << endl << endl;
40     
41     cout << "复数运算测试: " << endl;
42     cout << "abs(c2) = " << abs(c2) << endl;
43     
44     c1.add(c2);
45     cout << "c1 += c2, c1 = "; output(c1); cout << endl;
46     
47     cout << boolalpha;
48     cout << "c1 == c2 : " << is_equal(c1, c2) << endl;
49     cout << "c1 != c2 : " << is_not_equal(c1, c2) << endl;
50     
51     c4 = add(c2, c3);
52     cout << "c4 = c2 + c3, c4 = "; output(c4); cout << endl;
53 }
54 
55 void test_std_complex() {
56     using std::cout;
57     using std::endl;
58     using std::boolalpha;
59     
60     cout << "std::complex<double>对象测试: " << endl;
61     std::complex<double> c1;
62     std::complex<double> c2(3, -4);
63     std::complex<double> c3(c2);
64     std::complex<double> c4 = c2;
65     const std::complex<double> c5(3.5);
66     
67     cout << "c1 = " << c1 << endl;
68     cout << "c2 = " << c2 << endl;
69     cout << "c3 = " << c3 << endl;
70     cout << "c4 = " << c4 << endl;
71     cout << "c5.real = " << c5.real() 
72          << ", c5.imag = " << c5.imag() << endl << endl;
73     
74     cout << "复数运算测试: " << endl;
75     cout << "abs(c2) = " << abs(c2) << endl;
76     
77     c1 += c2;
78     cout << "c1 += c2, c1 = " << c1 << endl;
79     
80     cout << boolalpha;
81     cout << "c1 == c2 : " << (c1 == c2) << endl;
82     cout << "c1 != c2 : " << (c1 != c2) << endl;
83     
84     c4 = c2 + c3;
85     cout << "c4 = c2 + c3, c4 = " << c4 << endl;
86 }

问题1:标准库更简洁;有关联,这些函数本质上都是数学运算,使用运算符重载更符合数学直觉和编程习惯

问题2:2.1 是,理由:output(),abs(),add(),is_equal()is_not_equal()函数需要直接访问realimag来格式化输出,如果不使用友元,这些函数只能通过公有接口get_real()get_imag()来访问数据,但这样效率太低

2.2 否,根据cppreference.com:std::abs(std::complex)是一个非成员函数,它通过公有接口real()imag()来访问复数的实部和虚部,标准库设计遵循"除非必要,否则不使用友元"的原则

2.3 必要的时候:1.当函数确实需要直接访问类的私有成员,且无法通过公有接口有效实现时

2.运算符重载:特别是需要访问两个或多个对象私有数据的二元运算符

3.紧密相关的工具函数:如输入输出函数、类型转换函数等

问题3:在Complex.h中添加:

1 class Complex {
2 private:
3     Complex& operator=(const Complex&);
4     ...
5 public:
6     ...
7 };

任务三:

PlayerControl.h

 1 #pragma once
 2 #include <string>
 3 
 4 enum class ControlType {Play, Pause, Next, Prev, Stop, Unknown};
 5 
 6 class PlayerControl {
 7 public:
 8     PlayerControl();
 9 
10     ControlType parse(const std::string& control_str);   // 实现std::string --> ControlType转换
11     void execute(ControlType cmd) const;   // 执行控制操作(以打印输出模拟)       
12 
13     static int get_cnt();
14 
15 private:
16     static int total_cnt;   
17 };

PlayerControl.cpp

 1 #include "PlayerControl.h"
 2 #include <iostream>
 3 #include <algorithm>
 4 
 5 int PlayerControl::total_cnt = 0;
 6 
 7 PlayerControl::PlayerControl() {}
 8 
 9 ControlType PlayerControl::parse(const std::string& control_str) {
10     // 1. 将输入字符串转为小写,实现大小写不敏感
11     std::string lower_str = control_str;
12     std::transform(lower_str.begin(), lower_str.end(), lower_str.begin(), 
13                    [](unsigned char c) { return std::tolower(c); });
14     
15     // 2. 匹配"play"/"pause"/"next"/"prev"/"stop"并返回对应枚举
16     // 3. 未匹配的字符串返回ControlType::Unknown
17     ControlType result = ControlType::Unknown;
18     
19     if (lower_str == "play") {
20         result = ControlType::Play;
21     } else if (lower_str == "pause") {
22         result = ControlType::Pause;
23     } else if (lower_str == "next") {
24         result = ControlType::Next;
25     } else if (lower_str == "prev") {
26         result = ControlType::Prev;
27     } else if (lower_str == "stop") {
28         result = ControlType::Stop;
29     }
30     
31     // 4. 每次成功调用parse时递增total_cnt
32     total_cnt++;
33     
34     return result;
35 }
36 
37 void PlayerControl::execute(ControlType cmd) const {
38     switch (cmd) {
39     case ControlType::Play:  std::cout << "[play] Playing music...\n"; break;
40     case ControlType::Pause: std::cout << "[Pause] Music paused\n";    break;
41     case ControlType::Next:  std::cout << "[Next] Skipping to next track\n"; break;
42     case ControlType::Prev:  std::cout << "[Prev] Back to previous track\n"; break;
43     case ControlType::Stop:  std::cout << "[Stop] Music stopped\n"; break;
44     default:                 std::cout << "[Error] unknown control\n"; break;
45     }
46 }
47 
48 int PlayerControl::get_cnt() {
49     return total_cnt;
50 }

task3.cpp

 1 #include "PlayerControl.h"
 2 #include <iostream>
 3 
 4 void test() {
 5     PlayerControl controller;
 6     std::string control_str;
 7     std::cout << "Enter Control: (play/pause/next/prev/stop/quit):\n";
 8 
 9     while(std::cin >> control_str) {
10         if(control_str == "quit")
11             break;
12         
13         ControlType cmd = controller.parse(control_str);
14         controller.execute(cmd);
15         std::cout << "Current Player control: " << PlayerControl::get_cnt() << "\n\n";
16     }
17 }
18 
19 int main() {
20     test();
21     return 0;
22 }

运行结果:

屏幕截图 2025-10-22 172209

任务四:

Fraction.cpp:

  1 #include "Fraction.h"
  2 #include <iostream>
  3 #include <stdexcept>
  4 
  5 using namespace std;
  6 
  7 // 静态成员初始化
  8 const string Fraction::doc = "Fraction类 v 0.01版.\n目前仅支持分数对象的构造、输出、加/减/乘/除运算.";
  9 
 10 // 求最大公约数
 11 int Fraction::gcd(int a, int b) const {
 12     a = abs(a);
 13     b = abs(b);
 14     while (b != 0) {
 15         int temp = b;
 16         b = a % b;
 17         a = temp;
 18     }
 19     return a;
 20 }
 21 
 22 // 约分函数
 23 void Fraction::reduce() {
 24     if (down == 0) {
 25         throw runtime_error("分母不能为0");
 26     }
 27     
 28     // 处理符号:让分母始终为正
 29     if (down < 0) {
 30         up = -up;
 31         down = -down;
 32     }
 33     
 34     // 约分
 35     int common = gcd(up, down);
 36     if (common != 0) {
 37         up /= common;
 38         down /= common;
 39     }
 40     
 41     // 如果分子为0,分母设为1
 42     if (up == 0) {
 43         down = 1;
 44     }
 45 }
 46 
 47 // 构造函数
 48 Fraction::Fraction(int numerator, int denominator) : up(numerator), down(denominator) {
 49     reduce();
 50 }
 51 
 52 Fraction::Fraction(const Fraction& other) : up(other.up), down(other.down) {}
 53 
 54 // 成员函数实现
 55 int Fraction::get_up() const {
 56     return up;
 57 }
 58 
 59 int Fraction::get_down() const {
 60     return down;
 61 }
 62 
 63 Fraction Fraction::negative() const {
 64     return Fraction(-up, down);
 65 }
 66 
 67 // 工具函数实现
 68 void output(const Fraction& f) {
 69     if (f.get_down() == 1) {
 70         cout << f.get_up();
 71     } else {
 72         cout << f.get_up() << "/" << f.get_down();
 73     }
 74 }
 75 
 76 Fraction add(const Fraction& f1, const Fraction& f2) {
 77     int new_up = f1.get_up() * f2.get_down() + f2.get_up() * f1.get_down();
 78     int new_down = f1.get_down() * f2.get_down();
 79     return Fraction(new_up, new_down);
 80 }
 81 
 82 Fraction sub(const Fraction& f1, const Fraction& f2) {
 83     int new_up = f1.get_up() * f2.get_down() - f2.get_up() * f1.get_down();
 84     int new_down = f1.get_down() * f2.get_down();
 85     return Fraction(new_up, new_down);
 86 }
 87 
 88 Fraction mul(const Fraction& f1, const Fraction& f2) {
 89     int new_up = f1.get_up() * f2.get_up();
 90     int new_down = f1.get_down() * f2.get_down();
 91     return Fraction(new_up, new_down);
 92 }
 93 
 94 Fraction div(const Fraction& f1, const Fraction& f2) {
 95     if (f2.get_up() == 0) {
 96         cout << "分母不能为0";
 97         return Fraction(0, 1); // 返回一个默认值
 98     }
 99     int new_up = f1.get_up() * f2.get_down();
100     int new_down = f1.get_down() * f2.get_up();
101     return Fraction(new_up, new_down);
102 }

Fraction.h:

 1 #pragma once
 2 #include <string>
 3 
 4 class Fraction {
 5 private:
 6     int up;     // 分子
 7     int down;   // 分母
 8     
 9     // 内部工具函数:约分
10     void reduce();
11     // 内部工具函数:求最大公约数
12     int gcd(int a, int b) const;
13 
14 public:
15     static const std::string doc;
16     
17     // 构造函数
18     Fraction(int numerator = 0, int denominator = 1);
19     Fraction(const Fraction& other);
20     
21     // 获取分子分母
22     int get_up() const;
23     int get_down() const;
24     
25     // 求负运算
26     Fraction negative() const;
27 };
28 
29 // 工具函数声明
30 void output(const Fraction& f);
31 Fraction add(const Fraction& f1, const Fraction& f2);
32 Fraction sub(const Fraction& f1, const Fraction& f2);
33 Fraction mul(const Fraction& f1, const Fraction& f2);
34 Fraction div(const Fraction& f1, const Fraction& f2);

task4.cpp:

 1 #include "Fraction.h"
 2 #include <iostream>
 3 
 4 void test1();
 5 void test2();
 6 
 7 int main() {
 8     std::cout << "测试1: Fraction类基础功能测试\n";
 9     test1();
10     std::cout << "\n测试2: 分母为0测试: \n";
11     test2();
12     return 0;
13 }
14 
15 void test1() {
16     using std::cout;
17     using std::endl;   
18     
19     cout << "Fraction类测试: " << endl;
20     cout << Fraction::doc << endl << endl;
21     
22     Fraction f1(5);
23     Fraction f2(3, -4), f3(-18, 12);
24     Fraction f4(f3);
25     
26     cout << "f1 = "; output(f1); cout << endl;
27     cout << "f2 = "; output(f2); cout << endl;
28     cout << "f3 = "; output(f3); cout << endl;
29     cout << "f4 = "; output(f4); cout << endl;
30     
31     const Fraction f5(f4.negative());
32     cout << "f5 = "; output(f5); cout << endl;
33     
34     cout << "f5.get_up() = " << f5.get_up() 
35          << ", f5.get_down() = " << f5.get_down() << endl;
36     
37     cout << "f1 + f2 = "; output(add(f1, f2)); cout << endl;
38     cout << "f1 - f2 = "; output(sub(f1, f2)); cout << endl;
39     cout << "f1 * f2 = "; output(mul(f1, f2)); cout << endl;
40     cout << "f1 / f2 = "; output(div(f1, f2)); cout << endl;
41     cout << "f4 + f5 = "; output(add(f4, f5)); cout << endl;
42 }
43 
44 void test2() {
45     using std::cout;
46     using std::endl;
47     
48     Fraction f6(42, 55), f7(0, 3);
49     
50     cout << "f6 = "; output(f6); cout << endl;
51     cout << "f7 = "; output(f7); cout << endl;
52     cout << "f6 / f7 = "; output(div(f6, f7)); cout << endl;
53 }

运行结果:

屏幕截图 2025-10-22 215526

问题:

我选择的是自由函数方案,理由:友元方案可以直接访问类的私有成员,效率较高,但是破坏封装性,且维护困难;静态成员函数适用于函数与类紧密相关,但不需要特定对象实例,而这些数学运算函数本质上是通用的,不属于某个特定类;在小型项目中,命名空间可能带来不必要的复杂性

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/943788.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

GCM(Galois/Counter Mode) 认证加密算法实现

项目概述 根据NIST SP 800-38D标准实现 AES-GCM GHASH、IV 处理、计数器生成、认证标签 实现 外部引入 使用 PyCryptodome 提供的 AES 块加密 使用Python标准库hmac 使用os.urandom生成随机比特流(经查询是密码学安全…

10.13-10.19学习做题笔记

10.13 咕咕咕。 upd-10.18 补了一下[Ynoi2016]炸脖龙I。 显然是数据结构题Ynoi能不是吗。 看见这个幂塔,就可以想到拓展欧拉定理。发现\(a^p\equiv a^{\varphi(p)}\),而\(\begin{matrix}\underbrace{\varphi(\varphi(…

20232411 2025-2026-1 《网络与系统攻防技术》实验二实验报告

1.实验内容 掌握后门原理及免杀技术。 问题回答:例举你能想到的一个后门进入到你系统中的可能方式? 回答:同一网络的其他计算机遭到攻击,后门通过网络绕过防火墙进入到我系统中。 例举你知道的后门如何启动起来(wi…

Lampiao 靶场

nmap起手访问80页面访问1898有两个文件一个音频,一个图片 音频说了 tiagodirb目录枚举 dirb http://192.168.1.71:1898 扫描一下敏感信息生成字典 cewl http://192.168.1.71:1898/?q=node/1 -w lam.txt 爆破一下ssh h…

【学习笔记】slope-trick

[BalticOI 2004] Sequence (Day1) \(f_{i,x}\) 表示考虑前 \(i\) 个位置,当前放了 \(x\)。转移式如下: \[f_{i,x} = |a_i - x| + f_{i - 1,x} \]考虑建坐标系,有点 $(x,f_{i,x})。然后它就相当于给当前的函数加上个…

2025.10.22

今天早八上了离散数学,然后上了马原课,中午外卖到的时间很好,不太好吃,下次不点了,然后睡觉睡了一下午,晚上上音乐鉴赏课,然后去科技楼开部长例会。

有一云AI编辑器:2025年微信公众号排版的高效选择

作为个人自媒体运营者,你是否还在为公众号编辑器排版而头疼?写稿、找图、排版、分发……每一个环节都可能耗费大量时间。为了帮助大家找到最适合自己的工具,我亲测了市面上8款主流的微信公众号编辑器,从功能完整度…

20232318 2025-2026-1 《网络与系统攻防技术》实验二实验报告

一、实验核心原理与内容解析 本次实验聚焦 “后门原理与实践”,核心是通过工具配置、定时触发、漏洞利用等手段,实现对目标主机的远程控制与信息窃取,同时理解后门的植入、启动与隐藏机制。实验内容涵盖五类典型场景…

ubuntu 25.10 修改源 - ldx

ubuntu 25.10 修改源# Ubuntu sources have moved to /etc/apt/sources.list.d/ubuntu.sourcessudo gedit /etc/apt/sources.list.d/*.list

pytorch学习笔记(1)

pytorch的模块 Pytorch 官方文档链接: https://pytorch.org/docs/stable torch.nn:神经网络相关api torch.option: 优化算法 torch.utils.data : dataset,dataLoader1.pytorch和tensorflow区别2.tensor(向量)相关操作…

20232404 2025-2026-2 《网络与系统攻防技术》实验二实验报告

一、实验内容 (一)主要内容掌握后门核心原理。 学会如何设置后门,如netcat、socat、MSF meterpreter等工具的使用。 熟悉Linux与Windows系统的后门启动机制。(二)回答问题 (1) 例举你能想到的一个后门进入到你系统…

1020302118兰逸霏的第一次作业

作业一 1.用requests和BeautifulSoup库方法定向爬取给定网址(http://www.shanghairanking.cn/rankings/bcur/2020 )的数据,屏幕打印爬取的大学排名信息。排名 学校名称 省市 学校类型 总分1 清华大学 北京 综合 852…

MathType 7下载安装教程及激活教程wps嵌入教程(含下载+安装+汉化激活+安装包)

目录一、写在前面:为啥这篇MathType 7教程一定要看?二、先搞懂:MathType 7为啥是教育/科研必备?三、第一步:MathType 7安装包下载(2025实测无病毒,直链速取)四、核心步骤:MathType 7安装+汉化激活(每步带避坑…

论学习有感——驳学习(读书)无用论

从读书以来学习已经二十年有余,一直依靠着天分和性情在体制化的学习道路上浑浑噩噩的深造。有些许个问题,长期以来也没个自己的答案,顺着接受校方和老师的短期目标,也就一直这么过来了。近年来,随着社会上一些争执…

嵌入式软件分层架构设计 - lucky

一、什么是嵌入式分层架构 “嵌入式分层架构”并不是一个全新的架构类型,而是指在嵌入式系统开发中应用和实现分层架构的设计模式,它继承了通用分层架构的所有核心思想和优点,但根据嵌入式系统的独特约束和需求进行…

DP 基础题乱做

恶补基础 DP. CF1061C 多样性 转移是经典的子序列 DP,考虑前 \(i\) 个数,子序列长度为 \(j\) 的方案数. 转移: \[f_{i,j}=\begin{cases} f_{i-1,j-1}+f_{i-1,j}&j\mid a_i\\ f_{i-1,j}&otherwise. \end{cas…

20232315 2025-2026-1 《网络与系统攻防技术》实验二实验报告

20232315 2025-2026-1 《网络与系统攻防技术》实验二实验报告20232315 2025-2026-1 《网络与系统攻防技术》实验二实验报告 目录一、实验基本信息二、实验内容三、实验要求四、实验过程4.1使用netcat获取主机操作Shell…

2025-10-21 XQQ Round 赛后总结

赛时心路历程开 T1,然后 think 一会就秒掉了。大洋里一遍过。 开 T2,然后 think 一会就秒掉了。大洋里也是一遍过。 15:48 think T3,结果假了。但是注意到在 \(m=0\) 的时候是对的,10 分也是分。 16:25 想不到 T3。…

《中华人民共和国网络安全法》第二十一条这一核心考点

《网络安全法》第二十一条 考点精析 法条原文:国家实行网络安全等级保护制度。网络运营者应当按照网络安全等级保护制度的要求,履行下列安全保护义务,保障网络免受干扰、破坏或者未经授权的访问,防止网络数据泄露或…