当前位置: 首页 > news >正文

C++ Primer第五版_第十四章习题答案(21~30)

文章目录

      • 练习14.21
      • 练习14.22
        • 头文件
        • CPP文件
      • 练习14.23
        • 头文件
        • CPP文件
      • 练习14.24
        • 头文件
        • CPP文件
      • 练习14.25
      • 练习14.26
      • 练习14.27
      • 练习14.28
      • 练习14.29
      • 练习14.30

练习14.21

编写 Sales_data 类的+ 和+= 运算符,使得 + 执行实际的加法操作而 += 调用+。相比14.3节和14.4节对这两个运算符的定义,本题的定义有何缺点?试讨论之。

缺点:使用了一个 Sales_data 的临时对象,但它并不是必须的。

练习14.22

定义赋值运算符的一个新版本,使得我们能把一个表示 ISBN 的 string 赋给一个 Sales_data 对象。

头文件

#ifndef CP5_ex14_22_h
#define CP5_ex14_22_h#include <string>
#include <iostream>class Sales_data
{friend std::istream& operator>>(std::istream&, Sales_data&);friend std::ostream& operator<<(std::ostream&, const Sales_data&);friend Sales_data operator+(const Sales_data&, const Sales_data&);public:Sales_data(const std::string &s, unsigned n, double p) :bookNo(s), units_sold(n), revenue(n*p) {}Sales_data() : Sales_data("", 0, 0.0f) {}Sales_data(const std::string &s) : Sales_data(s, 0, 0.0f) {}Sales_data(std::istream &is);Sales_data& operator=(const std::string&);Sales_data& operator+=(const Sales_data&);std::string isbn() const { return bookNo; }private:inline double avg_price() const;std::string bookNo;unsigned units_sold = 0;double revenue = 0.0;
};std::istream& operator>>(std::istream&, Sales_data&);
std::ostream& operator<<(std::ostream&, const Sales_data&);
Sales_data operator+(const Sales_data&, const Sales_data&);inline double Sales_data::avg_price() const
{return units_sold ? revenue / units_sold : 0;
}#endif

CPP文件

#include "exercise14_22.h"Sales_data::Sales_data(std::istream &is) : Sales_data()
{is >> *this;
}Sales_data& Sales_data::operator+=(const Sales_data &rhs)
{units_sold += rhs.units_sold;revenue += rhs.revenue;return *this;
}std::istream& operator>>(std::istream &is, Sales_data &item)
{double price = 0.0;is >> item.bookNo >> item.units_sold >> price;if (is)item.revenue = price * item.units_sold;elseitem = Sales_data();return is;
}std::ostream& operator<<(std::ostream &os, const Sales_data &item)
{os << item.isbn() << " " << item.units_sold << " " << item.revenue << " " << item.avg_price();return os;
}Sales_data operator+(const Sales_data &lhs, const Sales_data &rhs)
{Sales_data sum = lhs;sum += rhs;return sum;
}Sales_data& Sales_data::operator=(const std::string &isbn)
{*this = Sales_data(isbn);return *this;
}

练习14.23

为你的StrVec 类定义一个 initializer_list 赋值运算符。

头文件

#ifndef CP5_STRVEC_H_
#define CP5_STRVEC_H_#include <memory>
#include <string>
#include <initializer_list>#ifndef _MSC_VER
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endifclass StrVec
{friend bool operator==(const StrVec&, const StrVec&);friend bool operator!=(const StrVec&, const StrVec&);friend bool operator< (const StrVec&, const StrVec&);friend bool operator> (const StrVec&, const StrVec&);friend bool operator<=(const StrVec&, const StrVec&);friend bool operator>=(const StrVec&, const StrVec&);public:StrVec() : elements(nullptr), first_free(nullptr), cap(nullptr) {}StrVec(std::initializer_list<std::string>);StrVec(const StrVec&);StrVec& operator=(const StrVec&);StrVec(StrVec&&) NOEXCEPT;StrVec& operator=(StrVec&&)NOEXCEPT;~StrVec();StrVec& operator=(std::initializer_list<std::string>);void push_back(const std::string&);size_t size() const { return first_free - elements; }size_t capacity() const { return cap - elements; }std::string *begin() const { return elements; }std::string *end() const { return first_free; }std::string& at(size_t pos) { return *(elements + pos); }const std::string& at(size_t pos) const { return *(elements + pos); }void reserve(size_t new_cap);void resize(size_t count);void resize(size_t count, const std::string&);private:std::pair<std::string*, std::string*> alloc_n_copy(const std::string*, const std::string*);void free();void chk_n_alloc() { if (size() == capacity()) reallocate(); }void reallocate();void alloc_n_move(size_t new_cap);void range_initialize(const std::string*, const std::string*);private:std::string *elements;std::string *first_free;std::string *cap;std::allocator<std::string> alloc;
};bool operator==(const StrVec&, const StrVec&);
bool operator!=(const StrVec&, const StrVec&);
bool operator< (const StrVec&, const StrVec&);
bool operator> (const StrVec&, const StrVec&);
bool operator<=(const StrVec&, const StrVec&);
bool operator>=(const StrVec&, const StrVec&);#endif

CPP文件

#include "exercise14_23.h"
#include <algorithm>void StrVec::push_back(const std::string &s)
{chk_n_alloc();alloc.construct(first_free++, s);
}std::pair<std::string*, std::string*>
StrVec::alloc_n_copy(const std::string *b, const std::string *e)
{auto data = alloc.allocate(e - b);return{ data, std::uninitialized_copy(b, e, data) };
}void StrVec::free()
{if (elements){for_each(elements, first_free, [this](std::string &rhs) { alloc.destroy(&rhs); });alloc.deallocate(elements, cap - elements);}
}void StrVec::range_initialize(const std::string *first, const std::string *last)
{auto newdata = alloc_n_copy(first, last);elements = newdata.first;first_free = cap = newdata.second;
}StrVec::StrVec(const StrVec &rhs)
{range_initialize(rhs.begin(), rhs.end());
}StrVec::StrVec(std::initializer_list<std::string> il)
{range_initialize(il.begin(), il.end());
}StrVec::~StrVec()
{free();
}StrVec& StrVec::operator = (const StrVec &rhs)
{auto data = alloc_n_copy(rhs.begin(), rhs.end());free();elements = data.first;first_free = cap = data.second;return *this;
}void StrVec::alloc_n_move(size_t new_cap)
{auto newdata = alloc.allocate(new_cap);auto dest = newdata;auto elem = elements;for (size_t i = 0; i != size(); ++i)alloc.construct(dest++, std::move(*elem++));free();elements = newdata;first_free = dest;cap = elements + new_cap;
}void StrVec::reallocate()
{auto newcapacity = size() ? 2 * size() : 1;alloc_n_move(newcapacity);
}void StrVec::reserve(size_t new_cap)
{if (new_cap <= capacity()) return;alloc_n_move(new_cap);
}void StrVec::resize(size_t count)
{resize(count, std::string());
}void StrVec::resize(size_t count, const std::string &s)
{if (count > size()){if (count > capacity()) reserve(count * 2);for (size_t i = size(); i != count; ++i)alloc.construct(first_free++, s);}else if (count < size()){while (first_free != elements + count)alloc.destroy(--first_free);}
}StrVec::StrVec(StrVec &&s) NOEXCEPT : elements(s.elements), first_free(s.first_free), cap(s.cap)
{// leave s in a state in which it is safe to run the destructor.s.elements = s.first_free = s.cap = nullptr;
}StrVec& StrVec::operator = (StrVec &&rhs) NOEXCEPT
{if (this != &rhs){free();elements = rhs.elements;first_free = rhs.first_free;cap = rhs.cap;rhs.elements = rhs.first_free = rhs.cap = nullptr;}return *this;
}bool operator==(const StrVec &lhs, const StrVec &rhs)
{return (lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin()));
}bool operator!=(const StrVec &lhs, const StrVec &rhs)
{return !(lhs == rhs);
}bool operator<(const StrVec &lhs, const StrVec &rhs)
{return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}bool operator>(const StrVec &lhs, const StrVec &rhs)
{return rhs < lhs;
}bool operator<=(const StrVec &lhs, const StrVec &rhs)
{return !(rhs < lhs);
}bool operator>=(const StrVec &lhs, const StrVec &rhs)
{return !(lhs < rhs);
}StrVec& StrVec::operator=(std::initializer_list<std::string> il)
{*this = StrVec(il);return *this;
}

练习14.24

你在7.5.1节的练习7.40中曾经选择并编写了一个类,你认为它应该含有拷贝赋值和移动赋值运算符吗?如果是,请实现它们。

头文件

#ifndef DATE_H
#define DATE_H#ifndef _MSC_VER
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif#include <iostream>
#include <vector>class Date
{friend  bool            operator ==(const Date& lhs, const Date& rhs);friend  bool            operator < (const Date &lhs, const Date &rhs);friend  bool            check(const Date &d);friend  std::ostream&   operator <<(std::ostream& os, const Date& d);
public:typedef std::size_t Size;// default constructorDate() = default;// constructor taking Size as daysexplicit Date(Size days);// constructor taking three SizeDate(Size d, Size m, Size y) : day(d), month(m), year(y) {}// constructor taking iostreamDate(std::istream &is, std::ostream &os);// copy constructorDate(const Date& d);// move constructorDate(Date&& d) NOEXCEPT;// copy operator=Date& operator= (const Date& d);// move operator=Date& operator= (Date&& rhs) NOEXCEPT;// destructor  --  in this case, user-defined destructor is not nessary.~Date() { std::cout << "destroying\n"; }// membersSize toDays() const;  //not implemented yet.Date& operator +=(Size offset);Date& operator -=(Size offset);private:Size    day = 1;Size    month = 1;Size    year = 0;
};static const Date::Size YtoD_400 = 146097;    //365*400 + 400/4 -3 == 146097
static const Date::Size YtoD_100 = 36524;    //365*100 + 100/4 -1 ==  36524
static const Date::Size YtoD_4 = 1461;    //365*4 + 1          ==   1461
static const Date::Size YtoD_1 = 365;    //365// normal year
static const std::vector<Date::Size> monthsVec_n =
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };// leap year
static const std::vector<Date::Size> monthsVec_l =
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };// non-member operators:  <<  >>  -   ==  !=  <   <=  >   >=
//
std::ostream&
operator <<(std::ostream& os, const Date& d);
std::istream&
operator >>(std::istream& is, Date& d);
int
operator - (const Date& lhs, const Date& rhs);
bool
operator ==(const Date& lhs, const Date& rhs);
bool
operator !=(const Date& lhs, const Date& rhs);
bool
operator < (const Date& lhs, const Date& rhs);
bool
operator <=(const Date& lhs, const Date& rhs);
bool
operator  >(const Date& lhs, const Date& rhs);
bool
operator >=(const Date& lhs, const Date& rhs);
Date
operator - (const Date& lhs, Date::Size  rhs);
Date
operator  +(const Date& lhs, Date::Size  rhs);//  utillities:
bool check(const Date &d);
inline bool
isLeapYear(Date::Size y);// check if the date object passed in is valid
inline bool
check(const Date &d)
{if (d.month == 0 || d.month >12)return false;else{//    month == 1 3 5 7 8 10 12if (d.month == 1 || d.month == 3 || d.month == 5 || d.month == 7 ||d.month == 8 || d.month == 10 || d.month == 12){if (d.day == 0 || d.day > 31) return false;elsereturn true;}else{//    month == 4 6 9 11if (d.month == 4 || d.month == 6 || d.month == 9 || d.month == 11){if (d.day == 0 || d.day > 30) return false;elsereturn true;}else{//    month == 2if (isLeapYear(d.year)){if (d.day == 0 || d.day >29)  return false;elsereturn true;}else{if (d.day == 0 || d.day >28)  return false;elsereturn true;}}}}
}inline bool
isLeapYear(Date::Size y)
{if (!(y % 400)){return true;}else{if (!(y % 100)){return false;}elsereturn !(y % 4);}
}
#endif // DATE_H

CPP文件

#include "exercise14_24.h"
#include <algorithm>// constructor taking Size as days
// the argument must be within (0, 2^32)
Date::Date(Size days)
{// calculate the yearSize y400 = days / YtoD_400;Size y100 = (days - y400*YtoD_400) / YtoD_100;Size y4 = (days - y400*YtoD_400 - y100*YtoD_100) / YtoD_4;Size y = (days - y400*YtoD_400 - y100*YtoD_100 - y4*YtoD_4) / 365;Size d = days - y400*YtoD_400 - y100*YtoD_100 - y4*YtoD_4 - y * 365;this->year = y400 * 400 + y100 * 100 + y4 * 4 + y;// check if leap and choose the months vector accordinglystd::vector<Size>currYear= isLeapYear(this->year) ? monthsVec_l : monthsVec_n;// calculate day and month using find_if + lambdaSize D_accumu = 0, M_accumu = 0;// @bug    fixed:  the variabbles above hade been declared inside the find_if as static//                 which caused the bug. It works fine now after being move outside.std::find_if(currYear.cbegin(), currYear.cend(), [&](Size m){D_accumu += m;M_accumu++;if (d < D_accumu){this->month = M_accumu;this->day = d + m - D_accumu;return true;}elsereturn false;});
}// construcotr taking iostream
Date::Date(std::istream &is, std::ostream &os)
{is >> day >> month >> year;if (is){if (check(*this)) return;else{os << "Invalid input! Object is default initialized.";*this = Date();}}else{os << "Invalid input! Object is default initialized.";*this = Date();}}// copy constructor
Date::Date(const Date &d) :
day(d.day), month(d.month), year(d.year)
{}// move constructor
Date::Date(Date&& d) NOEXCEPT :
day(d.day), month(d.month), year(d.year)
{ std::cout << "copy moving"; }// copy operator=
Date &Date::operator= (const Date &d)
{this->day = d.day;this->month = d.month;this->year = d.year;return *this;
}// move operator=
Date &Date::operator =(Date&& rhs) NOEXCEPT
{if (this != &rhs){this->day = rhs.day;this->month = rhs.month;this->year = rhs.year;}std::cout << "moving =";return *this;
}// conver to days
Date::Size Date::toDays() const
{Size result = this->day;// check if leap and choose the months vector accordinglystd::vector<Size>currYear= isLeapYear(this->year) ? monthsVec_l : monthsVec_n;// calculate result + days by monthsfor (auto it = currYear.cbegin(); it != currYear.cbegin() + this->month - 1; ++it)result += *it;// calculate result + days by yearsresult += (this->year / 400)      * YtoD_400;result += (this->year % 400 / 100)  * YtoD_100;result += (this->year % 100 / 4)    * YtoD_4;result += (this->year % 4)        * YtoD_1;return result;
}// member operators:   +=  -=Date &Date::operator +=(Date::Size offset)
{*this = Date(this->toDays() + offset);return *this;
}Date &Date::operator -=(Date::Size offset)
{if (this->toDays() > offset)*this = Date(this->toDays() - offset);else*this = Date();return *this;
}// non-member operators:  <<  >>  -   ==  !=  <   <=  >   >=std::ostream&
operator <<(std::ostream& os, const Date& d)
{os << d.day << " " << d.month << " " << d.year;return os;
}std::istream&
operator >>(std::istream& is, Date& d)
{if (is){Date input = Date(is, std::cout);if (check(input))    d = input;}return is;
}int operator -(const Date &lhs, const Date &rhs)
{return lhs.toDays() - rhs.toDays();
}bool operator ==(const Date &lhs, const Date &rhs)
{return (lhs.day == rhs.day) &&(lhs.month == rhs.month) &&(lhs.year == rhs.year);
}bool operator !=(const Date &lhs, const Date &rhs)
{return !(lhs == rhs);
}bool operator < (const Date &lhs, const Date &rhs)
{return lhs.toDays() < rhs.toDays();
}bool operator <=(const Date &lhs, const Date &rhs)
{return (lhs < rhs) || (lhs == rhs);
}bool operator >(const Date &lhs, const Date &rhs)
{return !(lhs <= rhs);
}bool operator >=(const Date &lhs, const Date &rhs)
{return !(lhs < rhs);
}Date operator - (const Date &lhs, Date::Size rhs)
{                                       //  ^^^ rhs must not be larger than 2^32-1// copy lhsDate result(lhs);result -= rhs;return result;
}Date operator + (const Date &lhs, Date::Size rhs)
{                                       //  ^^^ rhs must not be larger than 2^32-1// copy lhsDate result(lhs);result += rhs;return result;
}

练习14.25

上题的这个类还需要定义其他赋值运算符吗?如果是,请实现它们;同时说明运算对象应该是什么类型并解释原因。

是。如上题。

练习14.26

为你的 StrBlob 类、StrBlobPtr 类、StrVec 类和 String 类定义下标运算符。

练习14.27

为你的 StrBlobPtr 类添加递增和递减运算符。

练习14.28

为你的 StrBlobPtr 类添加加法和减法运算符,使其可以实现指针的算术运算。

练习14.29

为什么不定义const 版本的递增和递减运算符?

因为递增和递减会改变对象本身,所以定义 const 版本的毫无意义。

练习14.30

为你的 StrBlobPtr 类和在12.1.6节练习12.22中定义的 ConstStrBlobPtr 的类分别添加解引用运算符和箭头运算符。注意:因为 ConstStrBlobPtr 的数据成员指向const vector,所以ConstStrBlobPtr 中的运算符必须返回常量引用。

相关文章:

C++ Primer第五版_第十四章习题答案(21~30)

文章目录 练习14.21练习14.22头文件CPP文件 练习14.23头文件CPP文件 练习14.24头文件CPP文件 练习14.25练习14.26练习14.27练习14.28练习14.29练习14.30 练习14.21 编写 Sales_data 类的 和 运算符&#xff0c;使得 执行实际的加法操作而 调用。相比14.3节和14.4节对这两个运…...

服务器性能调优

硬件 如果是硬件瓶颈就换硬件 &#xff08;包括CPU、内存、网卡&#xff09; 软件 如果是方案架构设计有问题就换方案&#xff0c;比如mysql、redis方案有问题 建议先 top 看下软件瓶颈在哪&#xff0c;CPU、内存、网络&#xff08;netstat&#xff09;&#xff0c;哪个进程占…...

带你深入学习k8s--(三) pod 管理

目录 一、简介 1、什么是pod 2、为什么要有pod 二、pod的分类 0、pod常用命令命令 1、准备镜像 2、自主式pod 3、控制器创建pod 4、扩容pod数量 5、通过service暴露pod&#xff08;负载均衡&#xff0c;自动发起&#xff09; 6、更新应用版本 三、编写yaml文件 四、Pod生命周期…...

前端系列11集-ES6 知识总结

ES Module 优点 静态分析 浏览器和 Node 都支持 浏览器的新 API 能用模块格式提供 不再需要对象作为命名空间 export 用于规定模块的对外接口 输出的接口与其对应的值是动态绑定关系可以取到模块内部实时的值 import 用于输入其他模块提供的功能 具有提升效果&#xff0c;会提升…...

连接分析工具箱 | 利用CATO进行结构和功能连接重建

导读 本研究描述了一个连接分析工具箱(CATO)&#xff0c;用于基于扩散加权成像(DWI)和静息态功能磁共振成像(rs-fMRI)数据来重建大脑结构和功能连接。CATO是一个多模态软件包&#xff0c;使研究人员能够运行从MRI数据到结构和功能连接组图的端到端重建&#xff0c;定制其分析并…...

【目标检测论文阅读笔记】Detection of plane in remote sensing images using super-resolution

Abstract 由于大量的小目标、实例级噪声和云遮挡等因素&#xff0c;遥感图像的目标检测精度低&#xff0c;漏检率或误检率高。本文提出了一种新的基于SRGAN和YOLOV3的目标检测模型&#xff0c;称为SR-YOLO。解决了SRGAN网络 对超参数的敏感性和模态崩溃问题。同时&#xff0c;Y…...

外卖app开发流程全解析

外卖app开发是现代餐饮业的一个必备部分。在这个数字化时代&#xff0c;人们更愿意使用手机应用程序来订购食品。因此&#xff0c;为了满足客户需求&#xff0c;餐饮企业需要开发自己的外卖app。 第一步&#xff1a;确定目标受众 在开始外卖app的开发之前&#xff0c;需要确定…...

BUUCTF jarvisoj_level0

小白垃圾做题笔记而已&#xff0c;不建议阅读。。。 这道题感觉主要就是64位程序ebp8 题目中给出了shellcode 我们直接将返回地址覆盖就好。 在main函数中调用了vulnerable_function()函数。 vulnerable函数是一个漏洞函数&#xff1a;(存在缓溢出)&#xff0c;我们只需要将…...

网络安全之入侵检测

目录 网络安全之入侵检测 入侵检测经典理论 经典检测模型 入侵检测作用与原理 意义 异常检测模型&#xff08;Anomaly Detection&#xff09; 误用检测模型&#xff08;Misuse Detection&#xff09; 经典特征案例 ​编辑自定义签名 ​编辑 签名检查过程 检测生命周期…...

元数据管理

1、业务元数据 描述 ”数据”背后的业务含义主题定义&#xff1a;每段 ETL、表背后的归属业务主题。业务描述&#xff1a;每段代码实现的具体业务逻辑。标准指标&#xff1a;类似于 BI 中的语义层、数仓中的一致性事实&#xff1b;将分析中的指标进行规范化。标准维度&#xf…...

C# WebService的开发以及客户端调用

目录 1、WebService简介 1.1 什么是XML&#xff1f; 1.2 什么是Soap&#xff1f; 1.3 什么是WSDL&#xff1f; 2、WebService与WebApi的区别与优缺点 2.1 WebService与WebApi的区别&#xff1a; 2.2 WebService的优缺点&#xff1a; 2.3 WebApi的优缺点&#xff1a; 3…...

有符号数和无符号数左移和右移

主要是有符号数的左移。 有的说不管符号位&#xff0c;直接左移&#xff0c;所以可以一会正数一会复数 https://bbs.csdn.net/topics/391075092 有的说符号位不动&#xff0c;其他来左移 不明白了。。。。 https://blog.csdn.net/hnjzsyjyj/article/details/119721014 https://…...

Netty小白入门教程

一、概述 1.1 概念 Netty是一个异步的基于事件驱动(即多路复用技术)的网络应用框架&#xff0c;用于快速开发可维护、高性能的网络服务器和客户端。 1.2 地位 Netty在Java网络应用框架中的地位就好比&#xff0c;Spring框架在JavaEE开发中的地位。 以下的框架都使用了Nett…...

【逻辑位移和算数位移】

<< 运算符 && >> 运算符 正数位移 当 x>>n 中 x 为正数时&#xff0c;会将x的所有位右移x位&#xff0c;同时左边高位补0 显而易见&#xff0c;运算结束后&#xff0c;值为1 。 可知右移n位&#xff0c;结果就是 x / 2^n&#xff1a;7 / 2 ^2 1;…...

Blender3.5 边的操作

目录 1. 边操作1.1 边的细分 Subdivide1.2 边的滑移 Edge Slide1.3 边的删除1.4 边的溶解 Dissolve1.5 边线倒角 Bevel1.6 循环边 Loop Edges1.7 并排边 Ring Edges1.8 桥接循环边 1. 边操作 1.1 边的细分 Subdivide 在边选择模式&#xff0c;选中一条边&#xff0c;右键&…...

Java与Python、Node.js在人工智能和区块链应用程序开发中的比较

背景 Java、Python和Node.js都是常用的编程语言,它们在不同领域都有广泛的应用。在人工智能和区块链应用程序开发中,这三种语言都具有各自的优势和劣势。 Java的优势 Java在企业级应用中应用广泛,这得益于其跨平台性、安全性和稳定性等特点。在人工智能和区块链应用程序开…...

【计算机是怎么跑起来的】基础:计算机三大原则

【计算机是怎么跑起来的】基础&#xff1a;计算机三大原则 计算机的三个根本性基础1.计算机是执行输入&#xff0c;运算&#xff0c;输出的机器输入&#xff0c;运算&#xff0c;输出 2. 软件是指令和数据的集合指令数据 3. 计算机的处理方式有时与人们的思维习惯不同对计算机来…...

NXP公司LPC21XX+PID实现稳定温度控制

本例使用的是LPC21XX系列芯片提供的PWM功能实现稳定的温度控制。首先我们获得当前环境温度之后&#xff0c;再用设定的温度与当前温度相减&#xff0c;通过PID算法计算出当前输出脉宽&#xff0c;并将其输出到L298N模块中&#xff0c;使加热丝发热&#xff0c;形成闭环&#xf…...

【CE实战-生化危机4重置版】实现角色瞬移、飞翔

▒ 目录 ▒ 🛫 导读需求开发环境1️⃣ CE扫描内存,定位坐标地址(加密后的地址)2️⃣ 硬件写入断点,定位真实坐标地址内存写入断点,定位到访问地址分析代码...

强烈建议互联网人转战实体和农业,去了就是降维打击!实体太缺人才了,老板也不缺钱!...

大环境不好&#xff0c;互联网人该何去何从&#xff1f; 一位网友提出了一个新思路&#xff1a;强烈建议互联网同学转战实体、农业这些行业。实体真的太缺人才了&#xff0c;目前大部分实体都留下70后、80后在继续奋斗。其实实体老板很多都不缺钱&#xff0c;经过多年积累&…...

KubeSphere 容器平台高可用:环境搭建与可视化操作指南

Linux_k8s篇 欢迎来到Linux的世界&#xff0c;看笔记好好学多敲多打&#xff0c;每个人都是大神&#xff01; 题目&#xff1a;KubeSphere 容器平台高可用&#xff1a;环境搭建与可视化操作指南 版本号: 1.0,0 作者: 老王要学习 日期: 2025.06.05 适用环境: Ubuntu22 文档说…...

springboot 百货中心供应链管理系统小程序

一、前言 随着我国经济迅速发展&#xff0c;人们对手机的需求越来越大&#xff0c;各种手机软件也都在被广泛应用&#xff0c;但是对于手机进行数据信息管理&#xff0c;对于手机的各种软件也是备受用户的喜爱&#xff0c;百货中心供应链管理系统被用户普遍使用&#xff0c;为方…...

线程同步:确保多线程程序的安全与高效!

全文目录&#xff1a; 开篇语前序前言第一部分&#xff1a;线程同步的概念与问题1.1 线程同步的概念1.2 线程同步的问题1.3 线程同步的解决方案 第二部分&#xff1a;synchronized关键字的使用2.1 使用 synchronized修饰方法2.2 使用 synchronized修饰代码块 第三部分&#xff…...

Python爬虫实战:研究feedparser库相关技术

1. 引言 1.1 研究背景与意义 在当今信息爆炸的时代,互联网上存在着海量的信息资源。RSS(Really Simple Syndication)作为一种标准化的信息聚合技术,被广泛用于网站内容的发布和订阅。通过 RSS,用户可以方便地获取网站更新的内容,而无需频繁访问各个网站。 然而,互联网…...

Go 语言接口详解

Go 语言接口详解 核心概念 接口定义 在 Go 语言中&#xff0c;接口是一种抽象类型&#xff0c;它定义了一组方法的集合&#xff1a; // 定义接口 type Shape interface {Area() float64Perimeter() float64 } 接口实现 Go 接口的实现是隐式的&#xff1a; // 矩形结构体…...

从深圳崛起的“机器之眼”:赴港乐动机器人的万亿赛道赶考路

进入2025年以来&#xff0c;尽管围绕人形机器人、具身智能等机器人赛道的质疑声不断&#xff0c;但全球市场热度依然高涨&#xff0c;入局者持续增加。 以国内市场为例&#xff0c;天眼查专业版数据显示&#xff0c;截至5月底&#xff0c;我国现存在业、存续状态的机器人相关企…...

(二)原型模式

原型的功能是将一个已经存在的对象作为源目标,其余对象都是通过这个源目标创建。发挥复制的作用就是原型模式的核心思想。 一、源型模式的定义 原型模式是指第二次创建对象可以通过复制已经存在的原型对象来实现,忽略对象创建过程中的其它细节。 📌 核心特点: 避免重复初…...

Java面试专项一-准备篇

一、企业简历筛选规则 一般企业的简历筛选流程&#xff1a;首先由HR先筛选一部分简历后&#xff0c;在将简历给到对应的项目负责人后再进行下一步的操作。 HR如何筛选简历 例如&#xff1a;Boss直聘&#xff08;招聘方平台&#xff09; 直接按照条件进行筛选 例如&#xff1a…...

Redis数据倾斜问题解决

Redis 数据倾斜问题解析与解决方案 什么是 Redis 数据倾斜 Redis 数据倾斜指的是在 Redis 集群中&#xff0c;部分节点存储的数据量或访问量远高于其他节点&#xff0c;导致这些节点负载过高&#xff0c;影响整体性能。 数据倾斜的主要表现 部分节点内存使用率远高于其他节…...

使用 SymPy 进行向量和矩阵的高级操作

在科学计算和工程领域&#xff0c;向量和矩阵操作是解决问题的核心技能之一。Python 的 SymPy 库提供了强大的符号计算功能&#xff0c;能够高效地处理向量和矩阵的各种操作。本文将深入探讨如何使用 SymPy 进行向量和矩阵的创建、合并以及维度拓展等操作&#xff0c;并通过具体…...