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

C++ Primer Plus: 第10章(2)

第10章编程题:
(1)
Account.h:

#ifndef ACCOUNT_H_
#define ACCOUNT_H_#include <string>class Account
{
private:std::string name ;std::string code ;double money ;
public:Account() ;Account(std::string Name, std::string Code, double Money) ;~Account() ;void ShowAccout() ;void InputMoney(double Money) ;void OutputMoney(double Money) ;
} ;#endif

Account.cpp:

#include "Account.h"
#include <iostream>
#include <string>
using namespace std ;Account::Account()
{}Account::Account(string Name, string Code, double Money)
{name = Name ;code = Code ;money = Money ;
}Account::~Account()
{}void Account::ShowAccout()
{using std::ios_base ;ios_base::fmtflags orig = cout.setf(ios_base::fixed, ios_base::floatfield) ;std::streamsize prec = cout.precision(0) ;cout << "This customer, who is called " << name << ", and has $" << money << " in " << code << " Account.\n";cout.setf(orig, ios_base::floatfield) ;cout.precision(prec) ;
}void Account::InputMoney(double Money)
{money += Money ;
}void Account::OutputMoney(double Money)
{money -= Money ;
}

main.cpp:

#include "Account.h"
#include <iostream>const int Num = 8 ;int main()
{Account A[Num] = {Account("Jackie Chen", "098425345", 56943),Account("John Rebort", "*&%$#4586", 12366), Account("Bluse Amy", "3425834", 9032455),Account("Killy Joe", "@#%^&*890", 234568690),Account("Beyonce Jim", "*&^%$#678", 999912366),Account("Alan London", "5555555", 222222222222),Account("Jackie Chen", "098425345", 56943),Account("Floyd Dork", "4324049", 247)} ;std::cout << "Let's see everyone: \n" ;for (int i=0; i<Num; i++){A[i].ShowAccout() ;}std::cout << "\nNow everyone increases $100: \n" ;for (int i=0; i<Num; i++){A[i].InputMoney(100) ;}for (int i=0; i<Num; i++){A[i].ShowAccout() ;}std::cout << "\nNow everyone decreases $100: \n" ;for (int i=0; i<Num; i++){A[i].OutputMoney(100) ;}for (int i=0; i<Num; i++){A[i].ShowAccout() ;}
}

(2)
Person.h:

#ifndef PERSON_H_
#define PERSON_H_#include <string>
using namespace std ;class Person
{
private:static const int LIMIT = 25 ;string lname ;char fname[LIMIT] ;
public:Person() {lname = "" ; fname[0] = '\0' ;} ;Person(const string & ln, const char * fn = "Heyyou") ;void Show() const ;void FormalShow() const ; 
} ;#endif

Person.cpp:

#include "Person.h"
#include <iostream>
#include <cstring>
using namespace std ;Person::Person(const string & ln, const char * fn)
{lname = ln ;strcpy(fname, fn) ;
}void Person::Show() const
{cout << fname << " " << lname ;
}void Person::FormalShow() const 
{cout << lname << ", " << fname ;
}

main.cpp:

#include "Person.h"
#include <iostream>int main()
{Person one ;Person two("Smythecraft") ;Person three("Dimwiddy", "Sam") ;std::cout << "The name of one:\n" ;one.Show() ;std::cout << std::endl ;one.FormalShow() ;std::cout << "\nThe name of two:\n" ;two.Show() ;std::cout << std::endl ;two.FormalShow() ;std::cout << "\nThe name of three:\n" ;three.Show() ;std::cout << std::endl ;three.FormalShow() ;std::cout << std::endl ;
}

(3)
golf.h:

#ifndef GOLF_H_
#define GOLF_H_class golf
{
private:static const int Len = 40 ;char fullname[Len] ;int handicap ;
public:golf(const char * name = "", int hc = 0) ;~golf() ;int setgolf() ;void Handicap() ;void showgolf() const ;
} ;#endif

golf.cpp:

#include "golf.h"
#include <cstring>
#include <iostream>golf::golf(const char * name, int hc)
{strncpy(fullname, name, Len) ;handicap = hc ;
}golf::~golf()
{std::cout << "delete!\n" ;
}int golf::setgolf()
{using namespace std ;char name[Len] = {0} ;int hc ;cout << "Fullname: " ;if (cin.get(name, Len).get() == -1){cin.clear() ;        // 务必对输入队列进行重置cout << "Enter Fail!\n" ;return 0 ;}cout << "Handicap: " ;while(!(cin >> hc)){cin.clear() ;while(cin.get() != '\n') ;cout << "Please enter a number: " ;}cin.get() ;golf G(name, hc) ;*this = G ;return 1 ;
}void golf::Handicap()
{int hc ;std::cin >> hc ;(*this).handicap = hc ;
}void golf::showgolf() const
{std::cout << "The " << handicap << " player is "<< fullname << std::endl ;
}

main.cpp:

#include "golf.h"
#include <iostream>const int Num = 5 ;int main()
{using namespace std ;golf G[Num] ;int num = 0 ;cout << "Please input the information of all of players:\n" ;for (int i=0; i<Num; i++){cout << "#" << i+1 << ": \n" ;if(!G[i].setgolf()) break ;else num ++ ;}cout << "\nNow change everyone's handicap:\n" ;for (int i=0; i<num; i++){cout << "#" << i+1 << ": " ;G[i].Handicap() ; }cout << "\nAnd then display all players:\n" ;for (int i=0; i<num; i++){G[i].showgolf() ;}
}

(4)
Sales.h:

#ifndef SALES_H_
#define SALES_H_namespace SALES
{class Sales{private:static const int QUARTERS = 4 ;double sales[QUARTERS] ;double average ;double max ;double min ;public:Sales() ;Sales(const double ar[], int n) ;~Sales() ;void setSales() ;void ShowSales() const ;} ;
} #endif

Sales.cpp:

#include "Sales.h"
#include <iostream>
using namespace SALES ;Sales::Sales()
{min = max = average = 0 ;for (int i=0; i<QUARTERS; i++)sales[i] = 0 ;
}Sales::Sales(const double ar[], int n)
{int i ;for (i=0; i<n && i<QUARTERS; i++)sales[i] = ar[i] ;while (i<QUARTERS){sales[i] = 0 ;i ++ ;} min = max = sales[0] ;double total = 0 ;for (i=0; i<QUARTERS; i++){total += sales[i] ;if (min > sales[i]) min = sales[i] ;if (max < sales[i]) max = sales[i] ;}average = total / QUARTERS ;
}Sales::~Sales()
{std::cout << "delete!\n" ;
}void Sales::setSales()
{using namespace std ;int n ;cout << "Enter the number of double you want to input: " ;cin >> n ;double *ar = new double[n] ;cout << "Enter these numbers you want to input:\n" ;for (int i=0; i<n; i++){cin >> ar[i] ;}Sales S(ar, n) ;*this = S ;delete [] ar ;
}void Sales::ShowSales() const
{std::cout << "The members of Sales:\n" ;int i ;for (i=0; i<QUARTERS; i++){std::cout << sales[i] << " " ;}std::cout << std::endl ;std::cout << "max = " << max << std::endl ;std::cout << "min = " << min << std::endl ;std::cout << "average = " << average << std::endl ;
}

main.cpp:

#include "Sales.h"
#include <iostream>
using namespace SALES ;int main()
{using namespace std ;double ar[7] = {7, 6, 5, 4, 3, 2, 1} ;Sales S1(ar, 7) ;cout << "The content of S1:\n" ;S1.ShowSales() ;Sales S2 ;S2.setSales() ;cout << "The content of S2:\n" ;S2.ShowSales() ;
}

(5)
Stack.h:

#ifndef STACK_H_
#define STACK_H_struct customer {char fullname[35] ;double payment ;
} ;typedef customer Item ;class Stack
{
private:static const int MAX = 10 ;Item items[MAX] ;int top ;double total_payment ;
public:Stack() ;~Stack() ;bool isempty() const ;bool isfull() const ;bool push(const Item & e) ;bool pop(Item & e) ;
} ;#endif

Stack.cpp:

#include "Stack.h"
#include <cstring>
#include <iostream>Stack::Stack()
{top = -1 ;total_payment = 0 ;
}Stack::~Stack()
{std::cout << "Delete!\n" ;
}bool Stack::isempty() const
{if (top == -1) return true ;else return false ;
}bool Stack::isfull() const
{if (top == (MAX-1)) return true ;else return false ;
}bool Stack::push(const Item & e)
{if (top == (MAX-1)) return false ;top++ ;strcpy(items[top].fullname, e.fullname) ;items[top].payment = e.payment ;return true ;
}bool Stack::pop(Item & e)
{if (top == -1) return true ;strcpy(e.fullname, items[top].fullname) ;e.payment = items[top].payment ;top -- ;total_payment += e.payment ;std::cout << "total_payment = " << total_payment << std::endl ;return true ;
}

main.cpp:

#include "Stack.h"
#include <iostream>
#include <cctype>int main()
{using namespace std ;Stack St ;char ch ;Item item ;cout << "Please enter A to add a customer,\n" << "P to process a PO, or Q to quit.\n" ;while (cin>>ch && toupper(ch) != 'Q'){while (cin.get() != '\n')continue ;if (!isalpha(ch)){cout << '\a' ;continue ;}switch(ch){case 'A':case 'a': cout << "Enter a customer:\n" ;cout << "Fullname: " ;cin.get(item.fullname, 35).get() ;cout << "Payment: " ;cin >> item.payment ;if (!St.push(item))cout << "The Stack is full!\n" ;break ;case 'P':case 'p': cout << "Delete a customer:\n" ;if (!St.pop(item))cout << "The Stack is empty!\n" ;cout << "Fullname: " ;cout << item.fullname << endl ;cout << "Payment: " ;cout << item.payment << endl ;break ;}cout << "Please enter A to add a customer,\n"<< "P to process a PO, or Q to quit.\n" ;}cout << "Bye!\n" ;return 0 ;
}

(6)
Move.h:

#ifndef MOVE_H_
#define MOVE_H_class Move
{
private:double x ;double y ;
public:Move(double a = 0, double b = 0) ;~Move() ;void showmove() const ;Move add(const Move & m) const ;void reset(double a = 0, double b = 0) ;
} ;#endif

Move.cpp:

#include "Move.h"
#include <iostream>Move::Move(double a, double b)
{x = a ;y = b ;
}Move::~Move()
{std::cout << "Delete!\n" ;
}void Move::showmove() const
{std::cout << "In this object, x = " << x << ", "<< "y = " << y << std::endl ;
}Move Move::add(const Move & m) const
{Move M(m.x, m.y);return M ;
}void Move::reset(double a, double b) 
{x = a ;y = b ;
}

main.cpp:

#include "Move.h"int main()
{Move Begining ;Move Next(9, 8) ;Begining.showmove() ;Next.showmove() ;Move Destination = Begining.add(Next) ;Destination.showmove() ;
}

(7)
Plorg.h:

#ifndef PLORG_H_
#define PLORG_H_class Plorg
{
private:static const int MAX = 19 ;char fullname[MAX] ;int CI ;
public:Plorg(const char * name = "Plorga") ;~Plorg() ;void ResetCI(int ci) ;void ShowPlorg() const ;
} ;#endif

Plorg.cpp:

#include "Plorg.h"
#include <iostream>
#include <cstring>Plorg::Plorg(const char * name){strncpy(fullname, name, MAX) ;CI = 50 ;
}Plorg::~Plorg(){std::cout << "Delete!\n" ;
}void Plorg::ResetCI(int ci){CI = ci ;
}void Plorg::ShowPlorg() const
{std::cout << "The fullname: " << fullname << ", CI = " << CI << std::endl ;
}

main.cpp:

#include "Plorg.h"int main()
{Plorg P1("Jim Killy") ;Plorg P2("Jackie London") ;Plorg P3("Trump Jim") ;P1.ShowPlorg() ;P2.ShowPlorg() ;P3.ShowPlorg() ;P1.ResetCI(90) ;P2.ResetCI(80) ;P3.ResetCI(70) ;P1.ShowPlorg() ;P2.ShowPlorg() ;P3.ShowPlorg() ;
}

(8)
List.h:

#ifndef LIST_H_
#define LIST_H_typedef int Item ;
struct LinkList {Item ElemType ;LinkList * next ;
} ;class List
{
private:static const int MAX = 10 ;LinkList * head ;LinkList * rail ;LinkList * p ;int num ;
public:List() ;~List() ;bool Add(const Item & i) ;bool isEmpty() ;bool isFull() ;void visit(void (*pf)(Item & i)) ;
} ;#endif

List.cpp:

#include "List.h"
#include <iostream>List::List() {head = new LinkList ;head->next = NULL ;rail = p = head ;num = 0 ;
}List::~List() {while (head != rail) {p = head ;head = head -> next ;delete p ;}delete head ;head = rail = p = NULL ;num = 0 ;std::cout << "This List has been destroyed!\n" ;
}bool List::Add(const Item & i) {if (num == MAX) return false ;p = rail ;p->next = new LinkList ;p->next->ElemType = i ;p->next->next = NULL ;rail = p->next ;num++ ;return true ;
}bool List::isEmpty() {if (num == 0) return true ;else return false ;
}bool List::isFull() {if (num == MAX) return true ;else return false ;
}void List::visit(void (*pf)(Item & i)) {for (p = head->next; p; p=p->next)(*pf)(p->ElemType) ;
}

main.cpp:

#include "List.h"
#include <iostream>void Watch(Item & i) ;
void AddOne(Item & i) ;int main()
{using namespace std ;List L ;cout << "Let's input some numbers:\n" ;Item i ;while (cin>>i) {if (L.isFull()) {cout << "This List is filled!\n" ;break ;}else L.Add(i) ;}cout << "Let's see all of members from this List:\n" ;L.visit(Watch) ;cout << endl ;cout << "Let's add one to every member from this List:\n" ;L.visit(AddOne) ;L.visit(Watch) ;cout << endl ;
}void Watch(Item & i) {std::cout << i << " " ;
}void AddOne(Item & i) {i += 1 ;
}

相关文章:

C++ Primer Plus: 第10章(2)

第10章编程题&#xff1a; &#xff08;1&#xff09; Account.h: #ifndef ACCOUNT_H_ #define ACCOUNT_H_#include <string>class Account { private:std::string name ;std::string code ;double money ; public:Account() ;Account(std::string Name, std::string Co…...

c++中的extern关键字

extern关键字主要修饰变量或函数&#xff0c;表示该函数可以跨文件访问&#xff0c;或者表明该变量在其他文件定义&#xff0c;在此处引用。 extern修饰变量 &#xff08;1&#xff09;如果某变量int m在a.c中定义声明&#xff0c;则其他b.c文件访问时&#xff0c;需要用exte…...

javaScript:快乐学习计时器

目录 一.前言 二.计时器 1.计时器的分类 2. 创建计时器的方式 创建间隔计时器 创建方式三种 1.匿名函数 2.使用函数直接作为计时器的执行函数 2.使用函数直接作为计时器的执行函数,用字符串的形式写入 3.计时器的返回值 4.清除计时器 5.延迟计时器 相关代码 一.前言 在…...

onnxruntime 支持的所有后端

1 代码导出 import onnxruntime as ort aaa ort.get_all_providers() print(aaa)1. 1 下面是ort支持的所有后端 TensorrtExecutionProvider, CUDAExecutionProvider, MIGraphXExecutionProvider, ROCMExecutionProvider, OpenVINOExecutionProvider, DnnlExecutionProvider…...

k8s 自身原理 5

我们知道容器是通过 pod 来承载的&#xff0c;我们在 k8s 中&#xff0c;服务都是跑在 pod 里面的&#xff0c;pod 里面可以跑 1 个容器&#xff0c;或者跑多个容器&#xff0c;那么咱们 pod 里面跑 1 个服务容器&#xff0c;咱真的就以为里面就只有这样个容器吗&#xff1f; …...

机器视觉应用开发什么最重要?

&#xff08;QQ群有答疑&#xff09;零基础小白快速上手海康VisionMaster开发系列课程 高级语言在机器视觉就是工具&#xff0c;机器视觉软件&#xff0c;在机器视觉中也是工具&#xff0c;在机器视觉应用开发中&#xff0c;图像处理是最重要的&#xff0c;一切看图像&#xff…...

React+Typescript使用接口泛型处理props

好 刚讲完组件 那么 这次 我们来看一下 数据传递的 props 还是上文的案例 例如 我们想将 title 传给Hello组件 之前我们可以直接这样 以一个标签属性的形式传过去 而我们在子组件中 这样去使用 但现在 我们从编辑器中都可以看出 这种写法已经不行了 然后 我们将 hello 组件…...

自定义python文件import导入ModuleNotFoundError: No module named ‘***‘ 问题

自定义python文件import导入ModuleNotFoundError: No module named ‘***’ 问题 错误代码&#xff1a; import configparser import os.path import sys from bin import swk_mysql_create, swk_redis_create这里导入自定义python文件&#xff0c;其中swk_mysql_create.py文…...

Codeforces Round 893 (Div. 2)B题题解

文章目录 [The Walkway](https://codeforces.com/contest/1858/problem/B)问题建模问题分析1.分析所求2.如何快速计算每个商贩被去除后的饼干数量代码 The Walkway 问题建模 给定n个椅子&#xff0c;其中有m个位置存在商贩&#xff0c;在商贩处必须购买饼干吃&#xff0c;每隔…...

HTTP响应状态码大全:从100到511,全面解析HTTP请求的各种情况

文章目录 前言一、认识响应状态码1. 什么是HTTP响应状态码2. Http响应状态码的作用3. 优化和调试HTTP请求的建议 二、1xx 信息响应1. 认识http信息响应2. 常见的信息响应状态码 三、2xx 成功响应1. 认识HTTP成功响应2. 常见的成功响应状态码 四、3xx 重定向1. 认识http重定向2.…...

Vue-10.集成.env

.env、.env.development 和 .env.preview .env、.env.development 和 .env.preview 文件是用于配置环境变量和应用程序设置的文件&#xff0c;它们在项目开发和部署过程中起到关键作用。这些文件用于在不同的环境中设置不同的变量值&#xff0c;以满足不同环境下的配置需求。 …...

强训第33天

选择 C A ping是TCP/IP协议族的一部分&#xff0c;使用ICMP协议&#xff0c;ICMP底层使用IP协议。如果要ping其他网段&#xff0c;则需要设置网关。 如果是二层交换机故障&#xff0c;则ping同网段的也会不通。 C Dos攻击被称之为“拒绝服务攻击”&#xff0c;其目的是使计算机…...

【CTF-web】buuctf-[极客大挑战 2019]EasySQL 1(sql注入)

题目链接 根据题目判断出可能需要sql注入&#xff0c;看源码可知数据是通过GET的方式传输的&#xff0c;即放在url的username和password两个参数中。 只要将username输入为1 or 11#&#xff0c;password可以为任何值&#xff0c;即可顺利登录。 需要注意的是url中的井号表示…...

脚本语言与编译语言的区别

文章目录 一、语法差异二、执行方式差异三、应用领域差异四、总结 一、语法差异 脚本语言&#xff1a;脚本语言通常使用解释器逐行执行&#xff0c;不需要事先编译。它的语法相对简单&#xff0c;易于学习和使用。常见的脚本语言有Python、JavaScript和Ruby等。 编译语言&…...

大型企业或者组织,组建专属的虚拟局域网,深入理解相关的配置和搭建使用、网络加速和网络优化,可夸地区夸国际使用,深入搞懂每项配置的作用和含义

大型企业或者组织,组建专属的虚拟局域网,深入理解相关的配置和搭建使用、网络加速和网络优化,可夸地区夸国际使用,深入搞懂每项配置的作用和含义。 1、openxxx介绍与图解 1.1 openxxx介绍 openxxx 是一个基于 OpenSSL库的应用层 虚拟局域网 实现。和传统 虚拟局域网 相…...

数据结构:二叉树的递归实现(C实现)

个人主页 &#xff1a; 个人主页 个人专栏 &#xff1a; 《数据结构》 《C语言》 文章目录 前言一、树的概念二、二叉树二叉树的概念二叉树的性质 三、二叉树链式结构实现二叉树节点定义创建二叉树节点遍历二叉树先序遍历二叉树(BinaryTreePrevOrder)中序遍历二叉树(BinaryTree…...

MinGW编译运行报错RTTI symbol not found for class ‘XXX‘

最近在调试程序时莫名的出现图中报错&#xff1a; 还遇到过for class QObject&#xff0c;在此记录一下&#xff0c;排查后发现&#xff0c;原因都是有资源被重复释放导致的。...

table表头颜色 element plus

原图 预期 css :deep(.el-table__header) {background-color: #F5F7FA;} :deep(.el-table tr) {background-color: rgba(0,0,0,0);} :deep(.el-table th.el-table__cell) {background-color: rgba(0,0,0,0);}...

网络安全(自学)

想自学网络安全&#xff08;黑客技术&#xff09;首先你得了解什么是网络安全&#xff01;什么是黑客&#xff01; 网络安全可以基于攻击和防御视角来分类&#xff0c;我们经常听到的 “红队”、“渗透测试” 等就是研究攻击技术&#xff0c;而“蓝队”、“安全运营”、“安全…...

FPGA芯片IO口上下拉电阻的使用

FPGA芯片IO口上下拉电阻的使用 为什么要设置上下拉电阻一、如何设置下拉电阻二、如何设置上拉电阻为什么要设置上下拉电阻 这里以高云FPGA的GW1N-UV2QN48C6/I5来举例,这个芯片的上电默认初始化阶段,引脚是弱上来模式,且模式固定不能通过软件的配置来改变。如下图所示: 上…...

Leetcode 3576. Transform Array to All Equal Elements

Leetcode 3576. Transform Array to All Equal Elements 1. 解题思路2. 代码实现 题目链接&#xff1a;3576. Transform Array to All Equal Elements 1. 解题思路 这一题思路上就是分别考察一下是否能将其转化为全1或者全-1数组即可。 至于每一种情况是否可以达到&#xf…...

椭圆曲线密码学(ECC)

一、ECC算法概述 椭圆曲线密码学&#xff08;Elliptic Curve Cryptography&#xff09;是基于椭圆曲线数学理论的公钥密码系统&#xff0c;由Neal Koblitz和Victor Miller在1985年独立提出。相比RSA&#xff0c;ECC在相同安全强度下密钥更短&#xff08;256位ECC ≈ 3072位RSA…...

Zustand 状态管理库:极简而强大的解决方案

Zustand 是一个轻量级、快速和可扩展的状态管理库&#xff0c;特别适合 React 应用。它以简洁的 API 和高效的性能解决了 Redux 等状态管理方案中的繁琐问题。 核心优势对比 基本使用指南 1. 创建 Store // store.js import create from zustandconst useStore create((set)…...

SciencePlots——绘制论文中的图片

文章目录 安装一、风格二、1 资源 安装 # 安装最新版 pip install githttps://github.com/garrettj403/SciencePlots.git# 安装稳定版 pip install SciencePlots一、风格 简单好用的深度学习论文绘图专用工具包–Science Plot 二、 1 资源 论文绘图神器来了&#xff1a;一行…...

边缘计算医疗风险自查APP开发方案

核心目标:在便携设备(智能手表/家用检测仪)部署轻量化疾病预测模型,实现低延迟、隐私安全的实时健康风险评估。 一、技术架构设计 #mermaid-svg-iuNaeeLK2YoFKfao {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg…...

《从零掌握MIPI CSI-2: 协议精解与FPGA摄像头开发实战》-- CSI-2 协议详细解析 (一)

CSI-2 协议详细解析 (一&#xff09; 1. CSI-2层定义&#xff08;CSI-2 Layer Definitions&#xff09; 分层结构 &#xff1a;CSI-2协议分为6层&#xff1a; 物理层&#xff08;PHY Layer&#xff09; &#xff1a; 定义电气特性、时钟机制和传输介质&#xff08;导线&#…...

如何将联系人从 iPhone 转移到 Android

从 iPhone 换到 Android 手机时&#xff0c;你可能需要保留重要的数据&#xff0c;例如通讯录。好在&#xff0c;将通讯录从 iPhone 转移到 Android 手机非常简单&#xff0c;你可以从本文中学习 6 种可靠的方法&#xff0c;确保随时保持连接&#xff0c;不错过任何信息。 第 1…...

C#中的CLR属性、依赖属性与附加属性

CLR属性的主要特征 封装性&#xff1a; 隐藏字段的实现细节 提供对字段的受控访问 访问控制&#xff1a; 可单独设置get/set访问器的可见性 可创建只读或只写属性 计算属性&#xff1a; 可以在getter中执行计算逻辑 不需要直接对应一个字段 验证逻辑&#xff1a; 可以…...

Webpack性能优化:构建速度与体积优化策略

一、构建速度优化 1、​​升级Webpack和Node.js​​ ​​优化效果​​&#xff1a;Webpack 4比Webpack 3构建时间降低60%-98%。​​原因​​&#xff1a; V8引擎优化&#xff08;for of替代forEach、Map/Set替代Object&#xff09;。默认使用更快的md4哈希算法。AST直接从Loa…...

MySQL 8.0 事务全面讲解

以下是一个结合两次回答的 MySQL 8.0 事务全面讲解&#xff0c;涵盖了事务的核心概念、操作示例、失败回滚、隔离级别、事务性 DDL 和 XA 事务等内容&#xff0c;并修正了查看隔离级别的命令。 MySQL 8.0 事务全面讲解 一、事务的核心概念&#xff08;ACID&#xff09; 事务是…...