【上海大学《面向对象程序设计A》课程小项目报告】抽象向量类模板及其派生类
1 项目内容及要求
本项目通过设计一个抽象向量类模板,以及一个通用的向量类模板和一个字符串类作为其派生类,以满足各种应用场景中的数据存储和处理需求。
项目内容:
- 抽象向量类模板。
- 派生向量类。
- 派生字符串类。
- 测试及异常处理。
- 联合测试
2.1 抽象向量类模板
2.1.1 数据成员设计
int num;//向量的维度
T* p;//存储元素的数组
2.1.2 成员函数设计
VECTOR(int size = 0, const T* x = NULL)//构造函数
VECTOR(const VECTOR& v)//拷贝构造函数
virtual ~VECTOR()//虚析构函数
VECTOR& operator=(const VECTOR& v)//赋值运算符重载
T& operator[](int index)//用于访问特定位置的元素
void resize(int size)//重设容器大小
virtual void Output(ostream& out) const = 0;//纯虚函数
virtual void Input(istream& in) = 0;//纯虚函数
2.2 派生向量类模板
2.2.1 定义纯虚函数
void Output(ostream& out) const
{if (__super::num == 0) out << "( )";else{out << "(" << __super::p[0];for (int i = 1; i < __super::num; i++){out << "," << __super::p[i];}out << ")" << endl;}
}void Input(istream& in)
{char c;T x;__super::resize(0);in >> c;if (c != '(') return;while (in >> x){__super::resize(__super::num + 1);__super::p[__super::num - 1] = x;in >> c;if (c == ')') break;}
}
2.2.2 成员函数设计
Vector(int size = 0, const T* x = NULL)//构造函数
Vector operator+(const Vector& v)//+运算符重载
2.2.3 测试及异常处理
int TestVector()
{int a[10] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };double x[8];for (int i = 0; i < 8; i++)x[i] = sqrt(double(i));Vector<int> vi1(10, a), vi2(5, a + 5);Vector<double> vd1(8, x), vd2(3, x);cout << "原始数据:" << endl;cout << "vi1 = " << vi1 << "\nvi2 = " << vi2<< "\nvd1 = " << vd1 << "\nvd2 = " << vd2 << endl;cout << "调整维数到5:" << endl;vi1.resize(5);vi2.resize(5);vd1.resize(5);vd2.resize(5);cout << "vi1 = " << vi1 << "\nvi2 = " << vi2<< "\nvd1 = " << vd1 << "\nvd2 = " << vd2 << endl;cout << "\n将数据写入文件 vector.txt 中..." << endl;ofstream outfile("vector.txt");outfile << vi1 << '\n'<< vi2 << vd1 << '\n' << vd2 << endl;outfile.close();cout << "\n清除对象的数据(即调整维数到0)..." << endl;vi1.resize(0);vi2.resize(0);vd1.resize(0);vd2.resize(0);cout << "vi1 = " << vi1 << "\nvi2 = " << vi2<< "\nvd1 = " << vd1 << "\nvd2 = " << vd2 << endl;cout << "\n从文件 vector.txt 中读取的数据:" << endl;ifstream infile("vector.txt");infile >> vi1 >> vi2 >> vd1 >> vd2;infile.close();cout << "vi1 = " << vi1 << "\nvi2 = " << vi2<< "\nvd1 = " << vd1 << "\nvd2 = " << vd2 << endl;cout << "\nvi1 + vi2 = " << vi1 + vi2<< "\nvd1 + vd2 = " << vd1 + vd2 << endl;cout << "\n异常处理测试" << endl;Vector<int> v;cout << "请输入一个整数向量。如 (1, 3, 5, 7)" << endl;try{cin >> v;//如果格式错误,则抛出异常}catch (const char* str){cout << str << endl;return 0;}return 0;
}
运行结果:
2.3 派生字符串类
2.3.1 定义纯虚函数
void Output(ostream& out) const
{for (int i = 0; i < __super::num; i++){out << p[i];}
}void Input(istream& in)
{string temp;in >> temp;*this = temp.c_str();
}
2.3.2 成员函数设计
String(const char* x = "")//构造函数
String operator+(const String& s)//+运算符重载
2.3.3 测试及异常处理
int TestString()
{String str1 = "Hello", str2 = str1, str3;// 转换构造 拷贝构造 默认构造cout << "原始数据(双引号是另外添加的):" << endl;cout << "str1 = \"" << str1<< "\"\nstr2 = \"" << str2<< "\"\nstr3 = \"" << str3 << "\"" << endl;str3 = str2; // 赋值运算str1 = "C++ program.";str2 = str3 + ", world!"; // 拼接运算cout << "str1 = \"" << str1<< "\"\nstr2 = \"" << str2<< "\"\nstr3 = \"" << str3 << "\"" << endl;cout << "\n将数据写入文件 string.txt 中..." << endl;ofstream outfile("string.txt");outfile << str1 << '\n'<< str2 << '\n'<< str3 << endl;outfile.close();cout << "\n清除对象的数据(即调整长度到0)..." << endl;str1.resize(0);str2.resize(0);str3.resize(0);cout << "str1 = \"" << str1<< "\"\nstr2 = \"" << str2<< "\"\nstr3 = \"" << str3 << "\"" << endl;cout << "\n从文件 string.txt 中读取的数据:" << endl;ifstream infile("string.txt");infile >> str1>> str2>> str3;infile.close();cout << "str1 = \"" << str1<< "\"\nstr2 = \"" << str2<< "\"\nstr3 = \"" << str3 << "\"" << endl;cout << "\n异常处理测试" << endl;String str4 = "Hello";try{cout << str4 << endl;cout << str4[10] << endl;//越界访问,抛出异常}catch (const char* str){cout << str << endl;return 0;}return 0;
}
运行结果:
3 联合测试
#include "Vec.h"int TestVector(), TestString(), Test();void menu()
{cout << "\n1 --- testing Vector [v]"<< "\n2 --- testing String [s]"<< "\n3 --- testing Vector & String [m]"<< "\n0 --- exit [q]"<< endl;
}int main()
{char choice = '0';do{menu();cin >> choice;switch (choice){case '1':case 'v':case 'V': TestVector(); break;case '2':case 's':case 'S': TestString(); break;case '3':case 'm':case 'M': Test(); break;case '0':case 'q':case 'Q':case 27: choice = 0; break;default: cout << "选择错误,重新选择" << endl; break;}} while (choice);return 0;
}int Test()
{Vector<int> v;String str;cout << "请输入一个整数向量。如 (1, 3, 5, 7)" << endl;try{cin >> v;}catch (const char* str) { cout << str << endl;return 0;}cout << v << endl;cin.sync(); // 刷新输入流缓冲区(目的是读取并丢弃向量后的换行符)cout << "请输入一个字符串。如 abc 12345 xyz" << endl;cin >> str;cout << str << endl;cout << "\n将数据写入文件 output.txt 中..." << endl;ofstream outfile("output.txt");outfile << v << endl<< str << endl;outfile.close();cout << "\n清除对象的数据..." << endl;v.resize(0);str.resize(0);cout << "向量:" << v << endl<< "字符串:\"" << str << "\"" << endl;cout << "\n从文件 output.txt 中读取的数据:" << endl;ifstream infile("output.txt");infile >> v;infile >> str;infile.close();cout << "向量:" << v << endl<< "字符串:\"" << str << "\"" << endl;return 0;
}
运行结果:
4 完整代码
4.1 Vec.h
#pragma once
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <fstream>
#include <string>
using namespace std;template <typename T> class VECTOR
{
public:VECTOR(int size = 0, const T* x = NULL){num = (size > 0) ? size : 0;p = NULL;if (num > 0){p = new T[num];for (int i = 0; i < num; i++)p[i] = (x == NULL) ? 0 : x[i];}}VECTOR(const VECTOR& v){num = v.num;p = NULL;if (num > 0){p = new T[num];for (int i = 0; i < num; i++)p[i] = v.p[i];}}virtual ~VECTOR(){if (p != NULL) delete[] p;}VECTOR& operator=(const VECTOR& v){if (num != v.num){if (p != NULL) delete[] p;p = new T[num = v.num];}for (int i = 0; i < num; i++)p[i] = v.p[i];return *this;}T& operator[](int index){if (index >= num) throw "越界访问";else return p[index];}void resize(int size){if (size < 0 || size == num) return;else if (size == 0){if (p != NULL) delete[] p;num = 0;p = NULL;}else{T* temp = p;p = new T[size];for (int i = 0; i < size; i++)p[i] = (i < num) ? temp[i] : 0;num = size;delete[] temp;}}virtual void Output(ostream& out) const = 0;virtual void Input(istream& in) = 0;int num;//向量的维度T* p;//存储元素的数组
};template <typename T> ostream& operator<<(ostream& out, const VECTOR<T>& v)
{v.Output(out);return out;
}template <typename T> istream& operator>>(istream& in, VECTOR<T>& v)
{v.Input(in);return in;
}template <typename T> class Vector :public VECTOR<T>
{
public:Vector(int size = 0, const T* x = NULL) :VECTOR<T>(size, x) {}void Output(ostream& out) const{if (__super::num == 0) out << "( )";else{out << "(" << __super::p[0];for (int i = 1; i < __super::num; i++){out << "," << __super::p[i];}out << ")" << endl;}}void Input(istream& in){char c;T x;__super::resize(0);in >> c;if (c != '(') throw "格式错误";while (in >> x){__super::resize(__super::num + 1);__super::p[__super::num - 1] = x;in >> c;if (c == ')') break;}}Vector operator+(const Vector& v){Vector Add;if (__super::num == v.__super::num){Add.resize(__super::num);for (int i = 0; i < __super::num; i++){Add[i] = __super::p[i] + v.__super::p[i];}}return Add;}};class String : public VECTOR<char>
{
public:String(const char* x = "") : VECTOR<char>(strlen(x), x) { }void Output(ostream& out) const{for (int i = 0; i < __super::num; i++){out << p[i];}}void Input(istream& in){string temp;in >> temp;*this = temp.c_str();}String operator+(const String& s){int i, j;String add;add.__super::num = __super::num + s.__super::num;add.p = new char[add.__super::num];for (i = 0; i < __super::num; i++){add.p[i] = p[i];}for (j = 0; j < s.__super::num; j++){add.p[i + j] = s.p[j];}return add;}};
4.2 Test.cpp
#include "Vec.h"int TestVector(), TestString(), Test();void menu()
{cout << "\n1 --- testing Vector [v]"<< "\n2 --- testing String [s]"<< "\n3 --- testing Vector & String [m]"<< "\n0 --- exit [q]"<< endl;
}int main()
{char choice = '0';do{menu();cin >> choice;switch (choice){case '1':case 'v':case 'V': TestVector(); break;case '2':case 's':case 'S': TestString(); break;case '3':case 'm':case 'M': Test(); break;case '0':case 'q':case 'Q':case 27: choice = 0; break;default: cout << "选择错误,重新选择" << endl; break;}} while (choice);return 0;
}int Test()
{Vector<int> v;String str;cout << "请输入一个整数向量。如 (1, 3, 5, 7)" << endl;try{cin >> v;}catch (const char* str) { cout << str << endl;return 0;}cout << v << endl;cin.sync(); // 刷新输入流缓冲区(目的是读取并丢弃向量后的换行符)cout << "请输入一个字符串。如 abc 12345 xyz" << endl;cin >> str;cout << str << endl;cout << "\n将数据写入文件 output.txt 中..." << endl;ofstream outfile("output.txt");outfile << v << endl<< str << endl;outfile.close();cout << "\n清除对象的数据..." << endl;v.resize(0);str.resize(0);cout << "向量:" << v << endl<< "字符串:\"" << str << "\"" << endl;cout << "\n从文件 output.txt 中读取的数据:" << endl;ifstream infile("output.txt");infile >> v;infile >> str;infile.close();cout << "向量:" << v << endl<< "字符串:\"" << str << "\"" << endl;return 0;
}
4.3 TestString.cpp
#include "Vec.h"int TestString()
{String str1 = "Hello", str2 = str1, str3;// 转换构造 拷贝构造 默认构造cout << "原始数据(双引号是另外添加的):" << endl;cout << "str1 = \"" << str1<< "\"\nstr2 = \"" << str2<< "\"\nstr3 = \"" << str3 << "\"" << endl;str3 = str2; // 赋值运算str1 = "C++ program.";str2 = str3 + ", world!"; // 拼接运算cout << "str1 = \"" << str1<< "\"\nstr2 = \"" << str2<< "\"\nstr3 = \"" << str3 << "\"" << endl;cout << "\n将数据写入文件 string.txt 中..." << endl;ofstream outfile("string.txt");outfile << str1 << '\n'<< str2 << '\n'<< str3 << endl;outfile.close();cout << "\n清除对象的数据(即调整长度到0)..." << endl;str1.resize(0);str2.resize(0);str3.resize(0);cout << "str1 = \"" << str1<< "\"\nstr2 = \"" << str2<< "\"\nstr3 = \"" << str3 << "\"" << endl;cout << "\n从文件 string.txt 中读取的数据:" << endl;ifstream infile("string.txt");infile >> str1>> str2>> str3;infile.close();cout << "str1 = \"" << str1<< "\"\nstr2 = \"" << str2<< "\"\nstr3 = \"" << str3 << "\"" << endl;cout << "\n异常处理测试" << endl;String str4 = "Hello";try{cout << str4 << endl;cout << str4[10] << endl;//越界访问,抛出异常}catch (const char* str){cout << str << endl;return 0;}return 0;
}
4.4 TestVector.cpp
#include "Vec.h"int TestVector()
{int a[10] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };double x[8];for (int i = 0; i < 8; i++)x[i] = sqrt(double(i));Vector<int> vi1(10, a), vi2(5, a + 5);Vector<double> vd1(8, x), vd2(3, x);cout << "原始数据:" << endl;cout << "vi1 = " << vi1 << "\nvi2 = " << vi2<< "\nvd1 = " << vd1 << "\nvd2 = " << vd2 << endl;cout << "调整维数到5:" << endl;vi1.resize(5);vi2.resize(5);vd1.resize(5);vd2.resize(5);cout << "vi1 = " << vi1 << "\nvi2 = " << vi2<< "\nvd1 = " << vd1 << "\nvd2 = " << vd2 << endl;cout << "\n将数据写入文件 vector.txt 中..." << endl;ofstream outfile("vector.txt");outfile << vi1 << '\n'<< vi2 << vd1 << '\n' << vd2 << endl;outfile.close();cout << "\n清除对象的数据(即调整维数到0)..." << endl;vi1.resize(0);vi2.resize(0);vd1.resize(0);vd2.resize(0);cout << "vi1 = " << vi1 << "\nvi2 = " << vi2<< "\nvd1 = " << vd1 << "\nvd2 = " << vd2 << endl;cout << "\n从文件 vector.txt 中读取的数据:" << endl;ifstream infile("vector.txt");infile >> vi1 >> vi2 >> vd1 >> vd2;infile.close();cout << "vi1 = " << vi1 << "\nvi2 = " << vi2<< "\nvd1 = " << vd1 << "\nvd2 = " << vd2 << endl;cout << "\nvi1 + vi2 = " << vi1 + vi2<< "\nvd1 + vd2 = " << vd1 + vd2 << endl;cout << "\n异常处理测试" << endl;Vector<int> v;cout << "请输入一个整数向量。如 (1, 3, 5, 7)" << endl;try{cin >> v;//如果格式错误,则抛出异常}catch (const char* str){cout << str << endl;return 0;}return 0;
}
注意:
包含项目的文件夹中以下三个文本文档需要自行创建:
相关文章:

【上海大学《面向对象程序设计A》课程小项目报告】抽象向量类模板及其派生类
1 项目内容及要求 本项目通过设计一个抽象向量类模板,以及一个通用的向量类模板和一个字符串类作为其派生类,以满足各种应用场景中的数据存储和处理需求。 项目内容: 抽象向量类模板。派生向量类。派生字符串类。测试及异常处理。联合测试…...

Leetcode每日一题学习训练——Python3版(到达首都的最少油耗)
版本说明 当前版本号[20231205]。 版本修改说明20231205初版 目录 文章目录 版本说明目录到达首都的最少油耗理解题目代码思路参考代码 原题可以点击此 2477. 到达首都的最少油耗 前去练习。 到达首都的最少油耗 给你一棵 n 个节点的树(一个无向、连通、无环…...
Java面试题(每天10题)-------连载(42)
目录 Spring篇 1、Spring Bean的作用域之间有什么区别? 2、什么是Spring inner beans? 3、Spring框架中的单例Beans是线程安全的吗? 4、请举例说明如何在Spring中诸如一个Java Collection? 5、如何向Spring Bean中诸如一个J…...
netty websocket学习
【硬核】肝了一月的Netty知识点 超详细Netty入门,看这篇就够了! bzm_netty_sb netty-chat vuewebsokect实现实时聊天,可单聊、可群聊(一) vue实现聊天栏定位到最底部(超简单、可直接复制使用)…...

【数据结构】环形队列
环形队列 1. 定义 环形队列就是将队列在逻辑上看作环形结构、物理上仍是数组形式存储的一种数据结构。 其实现主要分为两种情况: 浪费空间法记录空间法 2. 实现 实现要考虑的是成员变量 2.1 记录空间法 使用used标识当前存储了多少元素,如果为空&a…...

嵌入式C编码规范
嵌入式C编码规范 编码规范,没有最好,只有最合适,有但不执行不如没有。 嵌入式C编码规范 https://mp.weixin.qq.com/s/z4u3YnF6vdQ1olsLeF-y_A 更多嵌入式信息请关注微信公众号【嵌入式系统】...

Golang 并发 — 流水线
并发模式 我们可以将流水线理解为一组由通道连接并由 goroutine 处理的阶段。每个阶段都被定义为执行特定的任务,并按顺序执行,下一个阶段在前一个阶段完成后开始执行。 流水线的另一个重要特性是,除了连接在一起,每个阶段都使用…...

Elasticsearch:什么是非结构化数据?
非结构化数据定义 非结构化数据是指未按照设计的模型或结构组织的数据。 非结构化数据通常被归类为定性数据,可以是人类或机器生成的。 非结构化数据是最丰富的可用数据类型,经过分析后,可用于指导业务决策并在许多其他用例中实现业务目标。…...

15:00的面试,15:06就出来了,问的问题过于变态了。。。
从小厂出来,没想到在另一家公司又寄了。 到这家公司开始上班,加班是每天必不可少的,看在钱给的比较多的份上,就不太计较了。没想到5月一纸通知,所有人不准加班,加班费不仅没有了,薪资还要降40%…...

Web自动化测试怎么做?Web网页测试全流程解析
1、功能测试 web网页测试中的功能测试,主要测试网页中的所有链接、数据库连接、用于在网页中提交或获取用户信息的表单、Cookie 测试等。 (1)查看所有链接: 测试从所有页面到被测特定域的传出链接。 测试所有内部链接。 测…...
MySQL数据库SQLSTATE[22007]: Invalid datetime format 日期类型不能为空值的解决办法
如果你的数据库是mysql, 如果你创建表或插入数据时遇到的BUG–它长这样: Invalid datetime format: 1292 Incorrect datetime value: ‘’ for column ‘xxx’ at row 1 或 1067 - Invalid default value for ‘xx’ 那么我将赐予你 两套剑法: &#…...

搬运工让你分分钟了解Web接口测试
01、什么是接口 百度说:接口泛指实体把自己提供给外界的一种抽象化物(可以为另一实体),用以由内部操作分离出外部沟通方法,使其能被内部修改而不影响外界其他实体与其交互的方式 上面这句有点抽象,网上的…...

作业12.5
1.定义一个基类 Animal,其中有一个虛函数perform(),用于在子类中实现不同的表演行为。 #include <iostream>using namespace std; class Animal { private:int weight; public:Animal(){}Animal(int weight):weight(weight){}virtual …...

leetCode 47. 全排列 II + 回溯算法 + 图解 + 笔记
给定一个可包含重复数字的序列 nums ,按任意顺序 返回所有不重复的全排列 示例 1: 输入:nums [1,1,2] 输出: [[1,1,2],[1,2,1],[2,1,1]] 示例 2: 输入:nums [1,2,3] 输出:[[1,2,3],[1,3,2…...

Maya 2024(3D建模、动画和渲染软件)
Maya 2024是一款非常强大的3D建模、动画和渲染软件,它提供了许多新功能和改进,以帮助建模师、动画师和渲染师更加高效地进行创作。 在建模方面,Maya 2024引入了Symmetry(对称)功能,可以在网格两侧生成均匀…...

C++作业5
完成沙发床的多继承(有指针成员) 代码: #include <iostream>using namespace std;class Bed { private:double *money; public:Bed(){cout << "Bed::无参构造函数" << endl;}Bed(double money):money(new doub…...

Go语言很难吗?为什么 Go 岗位这么少?
其实这个话题已经躺在我的 TODO 里很久了,近来很多社区的小伙伴都私下来交流,也有在朋友圈看吐槽 Go 上海的大会没什么人。还不如 Rust 大会,比较尴尬。 今天主要是从个人角度看看为什么 Go 岗位看起来近来很难的样子? 盘一下数…...

为什么要替换 Object.defineProperty?
目录 前言:为什么要替换 Object.defineProperty? 详解:为什么要替换 Object.defineProperty? 总结: 前言:为什么要替换 Object.defineProperty? JavaScript中的Object.defineProperty是一种…...

百马百担c语言编程
以下是一个百马百担问题的C语言编程实现: #include <stdio.h>int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); int a[n], b[m], c[k]; for (int i 0; i < n; i) { scanf("%d", &a[i]);…...

C++检测字符串中有效的括号个数
匹配一个字符串buf中,连续包换运算符reg的次数: #include <iostream>//return 返回匹配的字符个数 //buf, 要检测的字符串 //reg, 包含的连续运算符 int GetMatchCount(std::string& buf, std::string& reg) {int nMatchCount 0;if (reg.…...

深入浅出Asp.Net Core MVC应用开发系列-AspNetCore中的日志记录
ASP.NET Core 是一个跨平台的开源框架,用于在 Windows、macOS 或 Linux 上生成基于云的新式 Web 应用。 ASP.NET Core 中的日志记录 .NET 通过 ILogger API 支持高性能结构化日志记录,以帮助监视应用程序行为和诊断问题。 可以通过配置不同的记录提供程…...
基于数字孪生的水厂可视化平台建设:架构与实践
分享大纲: 1、数字孪生水厂可视化平台建设背景 2、数字孪生水厂可视化平台建设架构 3、数字孪生水厂可视化平台建设成效 近几年,数字孪生水厂的建设开展的如火如荼。作为提升水厂管理效率、优化资源的调度手段,基于数字孪生的水厂可视化平台的…...

2025盘古石杯决赛【手机取证】
前言 第三届盘古石杯国际电子数据取证大赛决赛 最后一题没有解出来,实在找不到,希望有大佬教一下我。 还有就会议时间,我感觉不是图片时间,因为在电脑看到是其他时间用老会议系统开的会。 手机取证 1、分析鸿蒙手机检材&#x…...

使用 Streamlit 构建支持主流大模型与 Ollama 的轻量级统一平台
🎯 使用 Streamlit 构建支持主流大模型与 Ollama 的轻量级统一平台 📌 项目背景 随着大语言模型(LLM)的广泛应用,开发者常面临多个挑战: 各大模型(OpenAI、Claude、Gemini、Ollama)接口风格不统一;缺乏一个统一平台进行模型调用与测试;本地模型 Ollama 的集成与前…...

【数据分析】R版IntelliGenes用于生物标志物发现的可解释机器学习
禁止商业或二改转载,仅供自学使用,侵权必究,如需截取部分内容请后台联系作者! 文章目录 介绍流程步骤1. 输入数据2. 特征选择3. 模型训练4. I-Genes 评分计算5. 输出结果 IntelliGenesR 安装包1. 特征选择2. 模型训练和评估3. I-Genes 评分计…...
Java 二维码
Java 二维码 **技术:**谷歌 ZXing 实现 首先添加依赖 <!-- 二维码依赖 --><dependency><groupId>com.google.zxing</groupId><artifactId>core</artifactId><version>3.5.1</version></dependency><de…...

10-Oracle 23 ai Vector Search 概述和参数
一、Oracle AI Vector Search 概述 企业和个人都在尝试各种AI,使用客户端或是内部自己搭建集成大模型的终端,加速与大型语言模型(LLM)的结合,同时使用检索增强生成(Retrieval Augmented Generation &#…...

C++使用 new 来创建动态数组
问题: 不能使用变量定义数组大小 原因: 这是因为数组在内存中是连续存储的,编译器需要在编译阶段就确定数组的大小,以便正确地分配内存空间。如果允许使用变量来定义数组的大小,那么编译器就无法在编译时确定数组的大…...

算法岗面试经验分享-大模型篇
文章目录 A 基础语言模型A.1 TransformerA.2 Bert B 大语言模型结构B.1 GPTB.2 LLamaB.3 ChatGLMB.4 Qwen C 大语言模型微调C.1 Fine-tuningC.2 Adapter-tuningC.3 Prefix-tuningC.4 P-tuningC.5 LoRA A 基础语言模型 A.1 Transformer (1)资源 论文&a…...

安全突围:重塑内生安全体系:齐向东在2025年BCS大会的演讲
文章目录 前言第一部分:体系力量是突围之钥第一重困境是体系思想落地不畅。第二重困境是大小体系融合瓶颈。第三重困境是“小体系”运营梗阻。 第二部分:体系矛盾是突围之障一是数据孤岛的障碍。二是投入不足的障碍。三是新旧兼容难的障碍。 第三部分&am…...