专题:C++常见最全类和对象中运算符的重载+完整代码

news2024/10/2 1:32:07

目录

一.运算符重载

1.1.“+”重载

成员函数实现方法:

类外友元函数实现方法:

1.2.“-”重载

成员函数实现方法:

 类外友元函数实现方法:

1.3.“*”重载

 成员函数实现方法:

 类外友元函数实现方法:

1.4.“/”重载

成员函数实现方法:

 类外友元函数实现方法:

二.输入输出流重载

2.1输入流重载:

2.2输出流重载:

三.成员函数实现方法和类外友元函数实现方法的完整代码

3.1成员函数实现方法:

3.2类外友元函数实现方法:


一.运算符重载

运算符重载一般有两种方法,分别是成员函数法类外函数友元法

成员函数法,顾名思义,就是将重载定义为类的函数成员;

类外友元函数法,就是利用类外单独的函数实现重载功能,并将函数和类建立起友元关系。

两种方法的显著区别就在于:

1.解决访问私有(保护)成员权限问题;

2.传入参数个数不同;(其实第二点区别派生于第一点)

下面对于每种常见的运算符的重载,都会给出两种方法的代码。

对于运算符重载,一般格式为:

1.类内成员函数:

class

{……

public:

        类名 operator 将要重载的运算符 (类名同型的数据类型 &)

        {

                类名同型的数据类型  结果变量;

                计算结果;

                return 结果变量;

        }

}

int main(){}

2.类外友元函数:

class

{

……

public:

        ……

        friend 类名 operator 将要重载的运算符 (类名同型数据类型 &对象1,类名同型数据类型&对象2);

}

friend 类名 operator 将要重载的运算符 (类名同型数据类型 &对象1,类名同型数据类型&对象2){

        类名同型的数据类型 结果变量;

        进行二元运算并将结果赋值给结果变量;

        返回结果变量;

}

int main (){}

以下是具体例子:

1.1.“+”重载

成员函数实现方法:

#include <iostream>
using namespace std;
class complex
{
protected:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	//重载运算符
	complex operator+(complex&);

};
inline complex complex::operator +(complex &c)
{
	complex temp;
	temp.real = this->real + c.real;
	temp.imag = this->imag + c.imag;
	return temp;
}

int main()
{
	complex a(1,2),b(2,3),c;
	c = a + b; 
    c.showcomplex();
	return 0;
}

类外友元函数实现方法:

#include<iostream>
using namespace std;
class complex
{
private:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	friend complex operator +(complex&, complex&);
};
complex operator+(complex& a, complex& b)
{
	complex temp;
	temp.real = a.real + b.real;
	temp.imag = a.imag + b.imag;
	return temp;
}
int main()
{
	complex a(1, 2), b(2, 3), c;
	c = a + b;
	c.showcomplex();
	return 0;
}

1.2.“-”重载

成员函数实现方法:

#include <iostream>
using namespace std;
class complex
{
protected:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	//重载运算符
	complex operator-(complex&);

};
inline complex complex::operator -(complex& c)
{
	complex temp;
	temp.real = this->real - c.real;
	temp.imag = this->imag - c.imag;
	return temp;
}

int main()
{
	complex a(1, 2), b(2, 3), c;
	c = a - b;
	c.showcomplex();
	return 0;
}

 类外友元函数实现方法:

#include<iostream>
using namespace std;
class complex
{
private:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	friend complex operator -(complex&, complex&);
};
complex operator-(complex& a, complex& b)
{
	complex temp;
	temp.real = a.real - b.real;
	temp.imag = a.imag - b.imag;
	return temp;
}
int main()
{
	complex a(1, 2), b(2, 3), c;
	c = a - b;
	c.showcomplex();
	return 0;
}

1.3.“*”重载

 成员函数实现方法:

#include <iostream>
using namespace std;
class complex
{
protected:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	//重载运算符
	complex operator*(complex&);

};
inline complex complex::operator *(complex& c)
{
	complex temp;
	temp.real = this->real * c.real - this->imag * c.imag;
	temp.imag = this->real * c.imag + this->imag * c.real;
	return temp;
}

int main()
{
	complex a(1, 2), b(2, 3), c;
	c = a * b;
	c.showcomplex();
	return 0;
}

 类外友元函数实现方法:

#include <iostream>
using namespace std;
class complex
{
protected:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	//重载运算符
	complex operator*(complex&);

};
inline complex complex::operator *(complex& c)
{
	complex temp;
	temp.real = this->real * c.real - this->imag * c.imag;
	temp.imag = this->real * c.imag + this->imag * c.real;
	return temp;
}

int main()
{
	complex a(1, 2), b(2, 3), c;
	c = a * b;
	c.showcomplex();
	return 0;
}

1.4.“/”重载

成员函数实现方法:

#include<iostream>
using namespace std;
class complex
{
private:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	complex operator /(complex&);
};
inline complex complex::operator/(complex& c)
{
	if (c.real == 0 && c.imag == 0)
	{
		cout << "error" << endl;
		exit(0);
	}
	else
	{
		complex temp;
		double under = c.real * c.real + c.imag * c.imag;
		temp.real = (this->real * c.real + this->imag * c.imag) / under;
		temp.imag = (this->imag * c.real - this->real * c.imag) / under;
		return temp;
	}
}
int main()
{
	complex a(1, 2), b(2, 3), c;
	c = a / b;
	c.showcomplex();
	complex d(5, 6), e(0, 0), f;
	f = d / e;
	f.showcomplex();
	return 0;
}

 类外友元函数实现方法:


#include<iostream>
using namespace std;
class complex
{
private:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	friend complex operator /(complex&,complex&);
};
complex operator/(complex& a, complex& b)
{
	if (b.real == 0 && b.imag == 0)
	{
		cout << "error" << endl;
		exit(0);
	}
	else
	{
		complex temp;
		double under = b.real * b.real + b.imag * b.imag;
		temp.real = (a.real * b.real + a.imag * b.imag) / under;
		temp.imag = (a.imag * b.real - a.real * b.imag) / under;
		return temp;
	}
}
int main()
{
	complex a(1, 2), b(2, 3), c;
	c = a / b;
	c.showcomplex();
	complex d(5, 6), e(0, 0), f;
	f = d / e;
	f.showcomplex();
	return 0;
}

运行结果:

 

二.输入输出流重载

输入输出流重载方法比较固定,一般格式为:

1.输入流重载:

class 类名

{

protected://或者private

        ……;

public:

        ……;

        friend istream & operator >>(istream&,类名同型数据类型&);

}

istream& operator >>(istream& 变量名1,类名同型数据类型& 变量名2)

{

        ……;//实现特定功能的代码

        return 变量名1;

}

2.输出流重载:

class 类名

{

protected://或者private

        ……;

public:

        ……;

        friend ostream &operator <<(ostream&,类名同型数据类型&);

}

ostream& operator <<(ostream& 变量名1,类名永兴数据类型& 变量名2)

{

        ……;//实现特定功能的代码

        return 变量名2;

}

2.1输入流重载:

#include <iostream>
using namespace std;
class complex
{
protected:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	//重载运算符
	complex operator+(complex&);
	complex operator-(complex&);
	complex operator*(complex&);
	complex operator/(complex&);
	//重载输入输出流
	friend istream& operator >> (istream&, complex&);

};
inline complex complex::operator +(complex &c)
{
	complex temp;
	temp.real = this->real + c.real;
	temp.imag = this->imag + c.imag;
	return temp;
}
inline complex complex::operator-(complex& c)
{
	complex temp;
	temp.real = this->real - c.real;
	temp.imag = this->imag - c.imag;
	return temp;
}

inline complex complex::operator*(complex& c)
{
	complex temp;
	temp.real = this->real * c.real - this->imag * c.imag;
	temp.imag = this->real * c.imag + this->imag * c.real;
	return temp;
}
inline complex complex::operator/(complex& c)
{
	complex temp;
	double under = c.real * c.real + c.imag * c.imag;
	if (under == 0)
	{
		cout << "error";
		exit(0);
	}
	temp.real = (this->real * c.real + this->imag * c.imag) / under;
	temp.imag = (this->imag * c.real - this->real * c.imag) / under;
	return temp;
}

istream& operator >> (istream& input, complex& c)
{
	cout << "请分别输入一个复数的实部和虚部:" << endl;
	input >> c.real >> c.imag;
	return input;
}
int main()
{
	complex a, b, c;
	cin >> a >> b;
	c = a + b; c.showcomplex();
	c = a - b; c.showcomplex();
	c = a * b; c.showcomplex();
	c = a / b; c.showcomplex();
	return 0;
}

2.2输出流重载:

#include <iostream>
using namespace std;
class complex
{
protected:
	double real, imag;
public:
	complex(double a = 0, double b = 0)
	{
		this->real = a;
		this->imag = b;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	//重载运算符
	complex operator+(complex&);
	complex operator-(complex&);
	complex operator*(complex&);
	complex operator/(complex&);
	//重载输入输出流
	friend istream& operator >> (istream&, complex&);
	friend ostream& operator<<(ostream&, complex&);

};
inline complex complex::operator +(complex &c)
{
	complex temp;
	temp.real = this->real + c.real;
	temp.imag = this->imag + c.imag;
	return temp;
}
inline complex complex::operator-(complex& c)
{
	complex temp;
	temp.real = this->real - c.real;
	temp.imag = this->imag - c.imag;
	return temp;
}

inline complex complex::operator*(complex& c)
{
	complex temp;
	temp.real = this->real * c.real - this->imag * c.imag;
	temp.imag = this->real * c.imag + this->imag * c.real;
	return temp;
}
inline complex complex::operator/(complex& c)
{
	complex temp;
	double under = c.real * c.real + c.imag * c.imag;
	if (under == 0)
	{
		cout << "error";
		exit(0);
	}
	temp.real = (this->real * c.real + this->imag * c.imag) / under;
	temp.imag = (this->imag * c.real - this->real * c.imag) / under;
	return temp;
}

istream& operator >> (istream& input, complex& c)
{
	cout << "请分别输入一个复数的实部和虚部:" << endl;
	input >> c.real >> c.imag;
	return input;
}
ostream& operator<<(ostream& output, complex& c)
{
	cout << "(" << c.real << "," << c.imag << "i)" << endl;
	return output;
}
int main()
{
	complex a, b, c;
	cin >> a >> b;
	c = a + b; cout << c;
	c = a - b; cout << c;
	c = a * b; cout << c;
	c = a / b; cout << c;
	return 0;
}

三.成员函数实现方法和类外友元函数实现方法的完整代码

3.1成员函数实现方法:

#include <iostream>
using namespace std;
class complex
{
private:
	double real, imag;
public:
	complex(double real = 0, double imag = 0)
	{
		this->real = real;
		this->imag = imag;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	//运算符重载
	friend complex operator+(complex&, complex&);
	friend complex operator-(complex&, complex&);
	friend complex operator*(complex&, complex&);
	friend complex operator/(complex&, complex&);
	//输入输出流重载
	friend istream& operator>>(istream&, complex&);
	friend ostream& operator<<(ostream&, complex&);

};
complex operator+(complex& a, complex& b)
{
	complex temp;
	temp.real = a.real + b.real;
	temp.imag = a.imag + b.imag;
	return temp;
}
complex operator-(complex& a, complex& b)
{
	complex temp;
	temp.real = a.real - b.real;
	temp.imag = a.imag - b.imag;
	return temp;
}
complex operator*(complex& a, complex& b)
{
	complex temp;
	temp.real = a.real * b.real - a.imag * b.imag;
	temp.imag = a.real * b.imag + a.imag * b.real;
	return temp;
}
complex operator/(complex& a, complex& b)
{
	if (b.imag == 0 && b.real == 0)
	{
		cout << "error" << endl;
		exit(0);
	}
	else
	{
		complex temp;
		double under = b.real * b.real + b.imag * b.imag;
		temp.real = (a.real * b.real + a.imag * b.imag) / under;
		temp.imag = (a.imag * b.real - a.real * b.imag) / under;
		return temp;
	}
}
istream& operator>>(istream& input, complex& c)
{
	cout << "请分别输入一个复数的实部和虚部:" << endl;
	input >> c.real >> c.imag;
	return input;
}
ostream& operator<<(ostream& output, complex& c)
{
	output << "(" << c.real << "," << c.imag << "i)" << endl;
	return output;
}
int main()
{
	complex a, b, c;
	cin >> a >> b;
	c = a + b; cout << c;
	c = a - b; cout << c;
	c = a * b; cout << c;
	c = a / b; cout << c;
	return 0;
}

3.2类外友元函数实现方法:

#include <iostream>
using namespace std;
class complex
{
private:
	double real, imag;
public:
	complex(double real = 0, double imag = 0)
	{
		this->real = real;
		this->imag = imag;
	}
	void showcomplex()
	{
		cout << "(" << this->real << "," << this->imag << "i)" << endl;
	}
	//运算符重载
	friend complex operator+(complex&, complex&);
	friend complex operator-(complex&, complex&);
	friend complex operator*(complex&, complex&);
	friend complex operator/(complex&, complex&);
	//输入输出流重载
	friend istream& operator>>(istream&, complex&);
	friend ostream& operator<<(ostream&, complex&);

};
complex operator+(complex& a, complex& b)
{
	complex temp;
	temp.real = a.real + b.real;
	temp.imag = a.imag + b.imag;
	return temp;
}
complex operator-(complex& a, complex& b)
{
	complex temp;
	temp.real = a.real - b.real;
	temp.imag = a.imag - b.imag;
	return temp;
}
complex operator*(complex& a, complex& b)
{
	complex temp;
	temp.real = a.real * b.real - a.imag * b.imag;
	temp.imag = a.real * b.imag + a.imag * b.real;
	return temp;
}
complex operator/(complex& a, complex& b)
{
	if (b.imag==0&&b.real==0)
	{
		cout << "error" << endl;
		exit(0);
	}
	else
	{
		complex temp;
		double under = b.real * b.real + b.imag * a.imag;
		temp.real = (a.real * b.real + a.imag * b.imag) / under;
		temp.imag = (a.imag * b.real - a.real * b.imag) / under;
		return temp;
	}
}
istream& operator>>(istream& input, complex& c)
{
	cout << "请分别输入一个复数的实部和虚部:" << endl;
	input >> c.real >> c.imag;
	return input;
}
ostream& operator<<(ostream& output, complex& c)
{
	output << "(" << c.real << "," << c.imag << "i)" << endl;
	return output;
}
int main()
{
	complex a, b, c;
	cin >> a >> b;
	c = a + b; cout << c;
	c = a - b; cout << c;
	c = a * b; cout << c;
	c = a / b; cout << c;
	return 0;
} 

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

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

相关文章

回溯算法3:组合总和III

主要是我自己刷题的一些记录过程。如果有错可以指出哦&#xff0c;大家一起进步。 转载代码随想录 原文链接&#xff1a; 代码随想录 leetcode链接&#xff1a;216.组合总和III 题目&#xff1a; 找出所有相加之和为 n 的 k 个数的组合&#xff0c;且满足下列条件&#xff1a…

使用IDEA社区版如何创建SpringBoot项目?

Spring Boot 就是 Spring 框架的脚⼿架&#xff0c;它就是为了快速开发 Spring 框架⽽诞⽣的。首先谈谈SpringBoot的优点&#xff1a;1.快速集成框架&#xff0c;Spring Boot 提供了启动添加依赖的功能&#xff0c;⽤于秒级集成各种框架。 2.内置运⾏容器&#xff0c;⽆需配置 …

MySQL语法之DQL数据查询语言(数据库的查询)

Java知识点总结&#xff1a;想看的可以从这里进入 目录2.5.4、DQL数据查询1、简单查询2、模糊查询3、连表查询4、自连接5、UNION6、排序7、分页查询8、分组查询9、子查询in10、子查询EXISTS2.5.4、DQL数据查询 数据库的基本功能&#xff0c;对数据进行查询。关键字select&…

MySQL基础知识-刷题笔记

数据库刷题笔记 查漏补缺&#xff0c;面试八股文&#xff0c;以下内容未说明的均以MySQL数据库为准 where 不能和聚合函数一起使用 having可以和聚合函数一起使用 having必须与group by一起使用1、SUBSTRING_INDEX(str ,substr ,n)&#xff1a;返回字符substr在str中第n次出现位…

udiMagic 导入 Excel to Tally ERP Crack

关于 udiMagic 软件 udiMagic 是一款可帮助您快速轻松地将数据导入 Tally ERP 的应用程序。它由 Shweta Softwares 创建和分发&#xff0c;于2007 年首次推出。 您可以在 USB 闪存驱动器 [旅行许可证] 中携带 udiMagic&#xff0c;并在具有任何 Tally 版本的任何计算机上使用…

Spring MVC 源码- LocaleResolver 组件

LocaleResolver 组件LocaleResolver 组件&#xff0c;本地化&#xff08;国际化&#xff09;解析器&#xff0c;提供国际化支持回顾先来回顾一下在 DispatcherServlet 中处理请求的过程中哪里使用到 LocaleResolver 组件&#xff0c;可以回到《一个请求的旅行过程》中的 Dispat…

【C++】json数据处理

Json是一种轻量级的数据交换格式。 文章目录1. cJson介绍2. 解析json数据3. 封装json数据4. 从文件中读取json1. cJson介绍 JSON对象是一个无序的"名称/值"键值对的集合&#xff1a; 以"{“开始&#xff0c;以”}"结束&#xff0c;允许嵌套使用&#xff…

相约3.8!罗姆EEPROM在线研讨会

科技的迭代更新速度不断超乎想象&#xff0c;人们也越来越追求数据的可追溯性和安全性&#xff0c;为避免意外情况导致数据丢失&#xff0c;在车载、工业等领域中&#xff0c;数据存储更经常使用安全性较好的EEPROM【带电可擦除可编程只读存储器】。与FLASH存储器的按“片”擦写…

偏向锁、轻量级所、自旋锁、重量级锁,它们都是什么?它们之间有什么关系?为什么会有这些锁?

互斥锁的本质是共享资源。 当有多个线程同时对一个资源进行操作时&#xff0c;为了线程安全&#xff0c;要对资源加锁。 更多基础内容参看上文《深入了解Java线程锁(一)》 接下来&#xff0c;我们来看看两个线程抢占重量级锁的情形&#xff1a; 上图讲述了两个线程ThreadA和…

JDBC-

文章目录JDBC1&#xff0c;JDBC概述1.1 JDBC概念1.2 JDBC本质1.3 JDBC好处2&#xff0c;JDBC快速入门2.1 编写代码步骤2.2 具体操作3&#xff0c;JDBC API详解3.1 DriverManager3.2 Connection &#xff08;事务归我管&#xff09;3.2.1 获取执行对象3.2.2 事务管理3.3 Stateme…

CSS 浮动【快速掌握知识点】

目录 前言 一、设置浮动属性 二、确定浮动元素的宽度 三、清除浮动 总结&#xff1a; 前言 CSS浮动是一种布局技术&#xff0c;它允许元素浮动到其父元素的左侧或右侧&#xff0c;从而腾出空间给其他元素。 一、设置浮动属性 使用CSS float属性将元素设置为浮动。例如&…

【华为OD机试模拟题】用 C++ 实现 - 数组的中心位置(2023.Q1)

最近更新的博客 华为OD机试 - 入栈出栈(C++) | 附带编码思路 【2023】 华为OD机试 - 箱子之形摆放(C++) | 附带编码思路 【2023】 华为OD机试 - 简易内存池 2(C++) | 附带编码思路 【2023】 华为OD机试 - 第 N 个排列(C++) | 附带编码思路 【2023】 华为OD机试 - 考古…

MySQL —— 表的约束

文章目录1. null 空属性2. default 默认值3. comment 列描述4. zerofill 格式化输出5. primary key 主键6. auto_increment 自增长7. 唯一键8. unique key 外键前言&#xff1a; 表的约束主要是靠数据类型。有些情况&#xff0c;光靠数据类型约束是不够的&#xff0c;比如想要限…

【Java】ThreadLocal原理

​ ThreadLocal ThreadLocal意为线程本地变量&#xff0c;用于解决多线程并发时访问共享变量的问题。 每个线程都会有属于自己的本地内存&#xff0c;在堆&#xff08;也就是上图的主内存&#xff09;中的变量在被线程使用的时候会被复制一个副本线程的本地内存中&#xff0c…

【H5 | CSS | JS】如何实现网页打字机效果?快收下这份超详细指南(附源码)

&#x1f482;作者简介&#xff1a; THUNDER王&#xff0c;一名热爱财税和SAP ABAP编程以及热爱分享的博主。目前于江西师范大学会计学专业大二本科在读&#xff0c;同时任汉硕云&#xff08;广东&#xff09;科技有限公司ABAP开发顾问。在学习工作中&#xff0c;我通常使用偏后…

在C#中初测OpencvSharp4

一、配置OpenCV 首先&#xff0c;我们新建一个工程&#xff0c;然后就是给这个工程配置OpenCV了&#xff0c;最简单的方法还是Nuget&#xff0c;来我们右键一个Nuget&#xff1a; 打开Nuget后&#xff0c;你可以直接输入OpenCVSharp4来查找&#xff0c;当然&#xff0c;如果你…

公司新来的00后真是卷王,工作没两年,跳槽到我们公司起薪20K都快接近我了

都说00后躺平了&#xff0c;但是有一说一&#xff0c;该卷的还是卷。这不&#xff0c;前段时间我们公司来了个00后&#xff0c;工作都没两年&#xff0c;跳槽到我们公司起薪18K&#xff0c;都快接近我了。后来才知道人家是个卷王&#xff0c;从早干到晚就差搬张床到工位睡觉了。…

罗永浩进场之后,苹果入局之前:XR又寒冬了吗?

科技圈的悲欢并不相通。ChatGPT狂飙之际&#xff0c;XR领域正在迎来至暗时刻。岁末年初&#xff0c;就在罗永浩重返高科技创业,计划进军XR&#xff08;扩展现实&#xff09;类领域的时间段前后&#xff0c;接连出现了押注元宇宙的Meta裁员&#xff0c;Meta旗下VR工作室Ready At…

【华为OD机试模拟题】用 C++ 实现 - 快递业务站(2023.Q1)

最近更新的博客 华为OD机试 - 入栈出栈(C++) | 附带编码思路 【2023】 华为OD机试 - 箱子之形摆放(C++) | 附带编码思路 【2023】 华为OD机试 - 简易内存池 2(C++) | 附带编码思路 【2023】 华为OD机试 - 第 N 个排列(C++) | 附带编码思路 【2023】 华为OD机试 - 考古…

【华为OD机试模拟题】用 C++ 实现 - 流水线(2023.Q1)

最近更新的博客 【华为OD机试模拟题】用 C++ 实现 - 分积木(2023.Q1) 【华为OD机试模拟题】用 C++ 实现 - 吃火锅(2023.Q1) 【华为OD机试模拟题】用 C++ 实现 - RSA 加密算法(2023.Q1) 【华为OD机试模拟题】用 C++ 实现 - 构成的正方形数量(2023.Q1) 【华为OD机试模拟…