C++奇迹之旅:从0开始实现日期时间计算器

请添加图片描述

文章目录

  • 📝前言
  • 🌠 头文件Date.h
    • 🌉日期计算函数
      • 🌠前后置++
      • 🌉前后置--
  • 🌠两对象日期相减
    • 🌉自定义流输入和输出
  • 🌉 代码
    • 🌉 头文件Date.h
    • 🌠Date.cpp
    • 🌉 Test.cpp
  • 🚩总结


📝前言

通过前面学完了C++的默认成员函数,实践出真知,本小节我们将一起来实现一个简单上手的日期时间计算器,阿森和你一起一步一步的操作实现!
完整代码在文章末尾哦
在这里插入图片描述

🌠 头文件Date.h

为了代码的维护性和可观型,我们在设置三个文件头文件Date.h,源文件Date.cppTest.cpp
我们先把头文件该写的写上:

#pragma once
#include<iostream>
using namespace std;

#include <stdbool.h>
#include <assert.h>
class Date
{
public:
	//全缺省构造函数
	Date(int year = 1, int month = 1, int day = 1);
	//拷贝构造函数:由于我们知道Date这种类,可写构造也可以不写,可以让编译器自动生成
	Date(const Date& d);
	//析构函数;和拷贝构造函数一样,可写也可以不写
	~Date()
	//打印函数,检验每一步代码错误
	void print();
	Date& operator+(const Date& d);
	
private:
	//内置类型:缺省值可给不给
	int _year = 1;
	int _month = 1;
	int _day = 1;
};

此时此刻,我们接下来要源文件Date.c来实现全缺省的构造函数:

Date::Date(int year, int month, int day)
{
	_year = year;
	_month = month;
	_day = day;
}

注意:这里我们全缺省构造函数进行声明与定义分离时,源文件定义时不需要缺省,也就是不要带值,否则如下图:将会重定义默认参数。
在这里插入图片描述
接下来我们实现打印函数

void Date::print()
{
	cout << _year << "-" << _month << "-" << _day << endl;
}

拷贝构造函数

Date::Date(const Date& d)
{
	_year = d._year;
	_month = d._month;
	_day = d._day;
}

赋值运算符重载

Date& Date::operator+(const Date& d)
{
	if (this != &d)
	{
		_year = d._year;
		_month = d._month;
		_day = d._day;
	}

	return *this;
}

此时此刻,头文件大致完成了,我们接下来要来实现简单的大小比较操作

如这些通用的运算符重载,你可以吧他们加到头文件Date.cDate里的public中:

bool operator<(const Date& d);
bool operator<=(const Date& d);
bool operator>(const Date& d);
bool operator>=(const Date& d);
bool operator==(const Date& d);
bool operator!=(const Date& d);

这里有六个运算符重载,我们只需实现1组:第一组:<和==,第二组:>和==,其他4个可以直接调用:
我们这里实现第一组:<和==

  1. <的运算符重载
bool Date::operator<(const Date& d)
{
    // 如果当前年份小于传入日期的年份,则当前日期小于传入日期
    if (_year < d._year)
    {
        return true;
    }
    // 如果年份相同,则比较月份
    else if (_year == d._year)
    {
        // 如果当前月份小于传入日期的月份,则当前日期小于传入日期
        if (_month < d._month)
        {
            return true;
        }
        // 如果月份相同,则比较日期
        else if (_month == d._month)
        {
            // 如果当前日期小于传入日期的日期,则当前日期小于传入日期
            if (_day < d._day)
            {
                return true;
            }
        }
    }

    // 如果以上条件都不满足,则当前日期不小于传入日期
    return false;
}
  1. ==运算符重载
bool Date::operator==(const Date& d)
{
	return _year == d._year
		&& _month == d._month
		&& _day == d._day;
}

两组都是按照年月日顺序进行逻辑判断

接下来就是有意思的调用操作了

  1. 小于等于意思是:小于或者等于
bool Date::operator<=(const Date& d)
{
	return (*this < d) || (*this == d);
}
  1. 大于意思:不小于等于
bool Date::operator>(const Date& d)
{
	return !(*this <= d);
}
  1. 大于等于:不小于
bool Date::operator>=(const Date& d) 
{
	return !(*this < d);
}

4.不等于就是等于的反面嘛

  bool Date::operator!=(const Date& d)
{
	return !(*this == d);
}

🌉日期计算函数

我们在一个日期上加天数,但是由于闰年和平年的2月的天数不同,如果在每次加,减天数,都要判断容易犯错,因此我们可以把它封装成一个函数,进行加天数的比较,我们可以定义一个数组,由于每次调用,可以设置成全局,用静态函数修饰。

int GetMonthDay(int year, int month)
{
	assert(month < 13 && month>0);
	static int dayArray[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 };
	
	if ((2 == month) && (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
	{
		return dayArray[month] + 1;//也可以直接写29
	}
	else
	{
		return dayArray[month];
	}
}

自身加天数类:

//d1+50
Date& operator+=(int day);
Date operator+(int day);

//d1-50
Date& operator-=(int day);
Date operator-(int day);

这里分为了两组:
你说得很对,这两个重载运算符的区别在于是否修改了原对象。

  1. operator+=是修改原对象的:
//d1+=50
Date& Date::operator+=(int day)
{
    // 将天数加到当前日期上
    _day += day;

    // 如果加上天数后,当前日期超过了当月的最大天数
    while (_day > GetMonthDay(_year, _month))
    {
        // 将当前日期减去当月的最大天数
        _day -= GetMonthDay(_year, _month);
        // 月份加1
        ++_month;
        // 如果月份超过了12月,则年份加1,月份重置为1月
        if (13 == _month)
        {
            ++_year;
            _month = 1;
        }
    }

    // 返回当前对象的引用
    return *this;
}
  

这个函数直接修改了当前对象的成员变量,返回的是当前对象的引用。因此,如果使用 d1 += 50;,那么 d1 对象本身会发生改变。

实现了加等,实现加就易如反掌了

  1. operator+是返回一个新对象:
    Date Date::operator+(int day)
    {
        Date temp = *this;
        temp += day;
        return temp;
    }
    
    这个函数首先创建了一个临时对象 temp,它是当前对象的副本。然后,它调用 operator+= 修改 temp 对象,最后返回 temp。因此,如果使用 d1 = d1 + 50;,那么 d1 对象本身不会发生改变,而是会返回一个新的 Date 对象。

上面是加等嵌套在加里面,下面是加嵌套在加等里面

Date Date::operator+(int day)
{
	Date temp = *this;
	
	temp += day;
	while (temp._day > GetMonthDay( temp._year, temp._month))
	{
		day -= GetMonthDay(temp._year, temp._month);
		++temp._month;
		if (13 == temp._month)
		{
			++temp._year;
			temp._month = 1;
		}

	}

	return temp;
}

Date& Date::operator+=(int day)
{
	*this = *this + day;

	return *this;
}

两种方法都是要创建新的变量,效果一样,第一种创建变量,拷贝构造,然后复用+=,返回的要创建临时对象,这种方式的优点是,在调用 operator+ 时,不需要重复计算日期的更新逻辑,因为 operator+= 已经实现了这个逻辑。但是第二种,由于*this = *this + day;*this+day中先调用+,然后在+中拷贝构造,然后返回临时对象,然后还要进行拷贝构造,对比第一种效率降低了,所以使用加复用加等性能更好
在这里插入图片描述
日期的加减也是如此:减等和减

Date& Date::operator-=(int day)
{
	_day -= day;
	if (0 == _day)
	{
		--_month;
		_day = GetMonthDay(_year, _month);
	}

	while (_day <= 0)
	{
		--_month;
		_day += GetMonthDay(_year, _month);
	}

	return *this;
}

// d1-50
Date Date::operator-(int day)
{
	Date temp = *this;
	temp -= day;

	return temp;
}

🌠前后置++

// 前置递增运算符重载
// 该运算符重载函数返回递增后的日期对象的引用
Date& Date::operator++()
{
    // 将当前日期对象加 1 天
    *this += 1;

    // 返回递增后的日期对象的引用
    return *this;
}

这是前置递增运算符重载函数,它返回递增后的日期对象的引用,因此可以支持连续的前置递增操作,如 ++d1;,实现方式是调用 operator+= 函数将当前日期对象加 1 天,然后返回当前对象的引用。

// 后置递增运算符重载
// 该运算符重载函数返回递增前的日期对象
Date Date::operator++(int)
{
    // 创建一个临时日期对象,保存当前日期对象的值
    Date temp(*this);

    // 将当前日期对象加 1 天
    *this += 1;

    // 返回递增前的临时日期对象
    return temp;
}

这是后置递增运算符重载函数。它返回递增前的日期对象,因此可以支持后置递增操作,如 d1++;。
实现方式是:创建一个临时日期对象,保存当前日期对象的值,调用 operator+= 函数将当前日期对象加 1 天,返回保存的临时日期对象。

这两个函数的主要区别在于返回值的不同。前置递增运算符返回递增后的日期对象的引用,而后置递增运算符返回递增前的日期对象。这种差异使得它们在使用时有不同的表现。

前置递增运算符通常更高效,因为它不需要创建临时对象。后置递增运算符需要创建一个临时对象来保存原始值,然后再执行递增操作,因此会稍微慢一些。

🌉前后置–

// 前置递减运算符重载
// 该运算符重载函数返回递减后的日期对象的引用
Date& Date::operator--()
{
    // 将当前日期对象减 1 天
    *this -= 1;

    // 返回递减后的日期对象的引用
    return *this;
}

这是前置递减运算符重载函数。它返回递减后的日期对象的引用,因此可以支持连续的前置递减操作,如 --d1;实现方式是调用 operator-= 函数将当前日期对象减 1 天,然后返回当前对象的引用。

// 后置递减运算符重载
// 该运算符重载函数返回递减前的日期对象
Date Date::operator--(int)
{
    // 创建一个临时日期对象,保存当前日期对象的值
    Date temp(*this);

    // 将当前日期对象减 1 天
    *this -= 1;

    // 返回递减前的临时日期对象
    return temp;
}

这是后置递减运算符重载函数。它返回递减前的日期对象,因此可以支持后置递减操作,如 d1–;。
实现方式是:创建一个临时日期对象,保存当前日期对象的值。调用 operator-= 函数将当前日期对象减 1 天,返回保存的临时日期对象。

前置递减运算符通常更高效,因为它不需要创建临时对象。

🌠两对象日期相减

//d1-d2
// 日期差运算符重载
// 该运算符重载函数返回两个日期对象之间的天数差
int Date::operator-(const Date& d)
{
    // 创建两个临时日期对象,分别保存较大和较小的日期
    Date max = *this;
    Date min = d;

    // 标记变量,用于记录较大日期是否在前
    int flag = 1;

    // 如果当前日期对象小于传入的日期对象
    if (*this < d)
    {
        // 交换两个临时日期对象的值,使 max 保存较大的日期
        max = d;
        min = *this;

        // 将标记变量设为 -1,表示较小日期在前
        flag = -1;
    }

    // 初始化天数差为 0
    int n = 0;

    // 循环递增较小日期,直到与较大日期相等
    while (min != max)
    {
        // 递增较小日期
        ++min;

        // 累加天数差
        ++n;
    }

    // 返回天数差,并根据标记变量的值确定正负
    return n * flag;
}

首先创建两个临时日期对象 maxmin,分别保存较大和较小的日期,然后判断当前日期对象是否小于传入的日期对象,如果是,则交换 maxmin 的值,并将标记变量 flag 设为 -1,接下来,使用 while 循环递增 min 日期,直到与 max 日期相等,同时累加天数差 n,最后,根据标记变量 flag 的值确定返回值的正负,即返回两个日期对象之间的天数差。

🌉自定义流输入和输出

通常我们可以输入的时候是不是想这样输入:cin>>d1或者输出cout<<d2,如下面这个流运算符重载,我们知道重载这里有this指针,顺序是thiscout,那么它的传参表示是d1<<cout,哇,这和我们平时的逻辑相反不可观,而且这只能定义在类里面,外部无法调用那咋办?

void Date::operator<<(ostream& out)
{
	out << _year << "年" << _month << "月" << _day << "日" << endl;
}

我们可以定义在全局作用域里,

// 重载输出运算符 <<
// 该运算符重载函数用于将日期对象输出到输出流中
ostream& operator<<(ostream& out, const Date& d)
{
    // 将日期对象的年、月、日输出到输出流中
    // 每个数值后跟相应的单位
    out << d._year << "年" << d._month << "月" << d._day << "日" << endl;

    // 返回输出流对象,以支持连续输出
    return out;
}

这是重载输出运算符 << 的函数。它接受一个输出流对象 out 和一个常量日期对象 d 作为参数,该函数返回输出流对象 out,以支持连续输出。

bool Date::CheckDate()
{
	if (_month < 1 || _month > 12
		|| _day < 1 || _day > GetMonthDay(_year, _month))
	{
		return false;
	}
	else
	{
		return true;
	}
}

// 重载输入运算符 >>
// 该运算符重载函数用于从输入流中读取日期对象的值
istream& operator>>(istream& in, Date& d)
{
    // 提示用户输入年/月/日
    cout << "请依次输入年/月/日:->";

    // 从输入流中读取年、月、日的值,并存储到日期对象d中
    in >> d._year >> d._month >> d._day;
    
	if (!d.CheckDate())//避免出现2024 4 0日
	{					
		cout << "日期非法" << endl;
	}

    // 返回输入流对象,以支持连续输入
    return in;
}

这是重载输入运算符 >> 的函数,它接受一个输入流对象 in 和一个可修改的日期对象 d 作为参数,该函数返回输入流对象 in,以支持连续输入。注意:CheckDate()为了防止输入 2024年4月0日

最后问题是在全局两个在全局变量中怎么能使用Date的内置类型呢?
没错!我是你的朋友就好啦!!!友元friend
我的朋友就可以用了嘛,这里可以定义在public里面也可以不在

#pragma once
#include<iostream>
using namespace std;

#include <stdbool.h>
#include <assert.h>
class Date
{
// 友元函数声明
	friend ostream& operator<<(ostream& out, const Date& d);
	friend istream& operator>>(istream& in, Date& d);
public:
	//全缺省构造函数
	Date(int year = 1, int month = 1, int day = 1);
	//拷贝构造函数:由于我们知道Date这种类,可写构造也可以不写,可以让编译器自动生成
	Date(const Date& d);
	//析构函数;和拷贝构造函数一样,可写也可以不写
	~Date()
	//打印函数,检验每一步代码错误
	void print();
	Date& operator+(const Date& d);
	
private:
	//内置类型:缺省值可给不给
	int _year = 1;
	int _month = 1;
	int _day = 1;
};

🌉 代码

🌉 头文件Date.h

#pragma once
#include<iostream>
using namespace std;

#include <stdbool.h>
#include <assert.h>
class Date
{
	//cout << d1
	friend ostream& operator<<(ostream& out, const Date& d);
	friend istream& operator>>(istream& in, Date& d);

public:
	Date(int year = 1, int month = 1, int day = 1);
	void print();
	Date& operator+(const Date& d);
	//定义到类里,默认是内敛函数
	int GetMonthDay(int year, int month)
	{
		assert(month < 13 && month>0);
		static int dayArray[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 };
		
		if ((2 == month) && (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
		{
			return dayArray[month] + 1;
		}
		else
		{
			return dayArray[month];
		}
	}


	bool CheckDate();

	bool operator<(const Date& d);
	bool operator<=(const Date& d);
	bool operator>(const Date& d);
	bool operator>=(const Date& d);
	bool operator==(const Date& d);
	bool operator!=(const Date& d);

	//d1+50
	Date& operator+=(int day);
	Date operator+(int day);

	//d1-50
	Date& operator-=(int day);
	Date operator-(int day);

	// ++d1
	Date& operator++();
	//d1++
	Date operator++(int);

	// --d1
	Date& operator--();
	// d1--
	Date operator--(int);

	//d1-d2
	int operator-(const Date& d);

private:
	int _year = 1;
	int _month = 1;
	int _day = 1;
};

//cout << d1
ostream& operator<<(ostream& out, const Date& d);
istream& operator>>(istream& in, Date& d);

🌠Date.cpp

#pragma once
#include "Date.h"

// 构造函数,初始化日期对象的年月日
Date::Date(int year, int month, int day)
{
    _year = year;
    _month = month;
    _day = day;
}

// 拷贝构造函数,创建一个新的日期对象并初始化为与给定日期对象相同的值
Date::Date(const Date& d)
{
    _year = d._year;
    _month = d._month;
    _day = d._day;
}

// 打印日期对象的年月日
void Date::print()
{
    cout << _year << "-" << _month << "-" << _day << endl;
}

// 重载小于运算符,比较两个日期对象的大小
bool Date::operator<(const Date& d)
{
    // 先比较年份,如果年份小于则返回true
    if (_year < d._year)
        return true;
    // 如果年份相同,再比较月份,如果月份小于则返回true
    else if (_year == d._year && _month < d._month)
        return true;
    // 如果年份和月份都相同,再比较日期,如果日期小于则返回true
    else if (_year == d._year && _month == d._month && _day < d._day)
        return true;
    // 其他情况返回false
    return false;
}

// 重载小于等于运算符,比较两个日期对象是否相等或者前者小于后者
bool Date::operator<=(const Date& d)
{
    return (*this < d) || (*this == d);
}

// 重载大于运算符,比较两个日期对象的大小
bool Date::operator>(const Date& d)
{
    return !(*this <= d);
}

// 重载大于等于运算符,比较两个日期对象是否相等或者前者大于后者
bool Date::operator>=(const Date& d)
{
    return !(*this < d);
}

// 重载等于运算符,比较两个日期对象的年月日是否相同
bool Date::operator==(const Date& d)
{
    return _year == d._year && _month == d._month && _day == d._day;
}

// 重载不等于运算符,比较两个日期对象是否不相同
bool Date::operator!=(const Date& d)
{
    return !(*this == d);
}

// 重载加法运算符,将两个日期对象的年月日相加
Date& Date::operator+(const Date& d)
{
    if (this != &d)
    {
        _year = d._year;
        _month = d._month;
        _day = d._day;
    }
    return *this;
}

// 重载加等于运算符,将当前日期对象加上指定的天数
Date& Date::operator+=(int day)
{
    _day += day;
    while (_day > GetMonthDay(_year, _month))
    {
        _day -= GetMonthDay(_year, _month);
        ++_month;
        if (13 == _month)
        {
            ++_year;
            _month = 1;
        }
    }
    return *this;
}

// 重载加法运算符,创建一个新的日期对象并将当前日期对象加上指定的天数
Date Date::operator+(int day)
{
    Date temp = *this;
    temp += day;
    return temp;
}

// 重载减等于运算符,将当前日期对象减去指定的天数
Date& Date::operator-=(int day)
{
    _day -= day;
    if (0 == _day)
    {
        --_month;
        _day = GetMonthDay(_year, _month);
    }
    while (_day <= 0)
    {
        --_month;
        _day += GetMonthDay(_year, _month);
    }
    return *this;
}

// 重载减法运算符,创建一个新的日期对象并将当前日期对象减去指定的天数
Date Date::operator-(int day)
{
    Date temp = *this;
    temp -= day;
    return temp;
}

// 重载前置递增运算符,将当前日期对象加1天
Date& Date::operator++()
{
    *this += 1;
    return *this;
}

// 重载后置递增运算符,将当前日期对象加1天并返回原始值
Date Date::operator++(int)
{
    Date temp(*this);
    *this += 1;
    return temp;
}

// 重载前置递减运算符,将当前日期对象减1天
Date& Date::operator--()
{
    *this -= 1;
    return *this;
}

// 重载后置递减运算符,将当前日期对象减1天并返回原始值
Date Date::operator--(int)
{
    Date temp(*this);
    *this -= 1;
    return temp;
}

// 重载减法运算符,计算两个日期对象之间的天数差
int Date::operator-(const Date& d)
{
    Date max = *this;
    Date min = d;
    int flag = 1;
    if (*this < d)
    {
        max = d;
        min = *this;
        flag = -1;
    }
    int n = 0;
    while (min != max)
    {
        ++min;
        ++n;
    }
    return n * flag;
}

// 重载输出运算符,将日期对象的年月日输出到流中
ostream& operator<<(ostream& out, const Date& d)
{
    out << d._year << "年" << d._month << "月" << d._day << "日" << endl;
    return out;
}

// 检查日期是否合法
bool Date::CheckDate()
{
    if (_month < 1 || _month > 12 || _day < 1 || _day > GetMonthDay(_year, _month))
        return false;
    else
        return true;
}

// 重载输入运算符,从输入流中读取年月日并创建日期对象
istream& operator>>(istream& in, Date& d)
{
    cout << "请依次输入年/月/日:->";
    in >> d._year >> d._month >> d._day;
    if (!d.CheckDate())
        cout << "日期非法" << endl;
    return in;
}

🌉 Test.cpp

# define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;

#include "Date.h"
void TestDate1()
{
	Date d1(2024, 4, 14);
	Date d2 = d1 + 50;
	d1.print();
	d2.print();

	Date d3(2024, 4, 14);
	Date d4 = d3 - 50;
	d3.print();
	d4.print();

}

void TestDate2()
{
	Date d1(2024, 4, 14);
	Date d2 = ++d1;
	d2.print();

	Date d3(2024, 4, 14);
	Date d4 = d3++;
	d4.print();
}

void TestDate3()
{
	Date d1(2024, 4, 14);
	Date d2 = --d1;
	d2.print();

	Date d3(2024, 4, 14);
	Date d4 = d3--;
	d4.print();

}

void TestDate4()
{
	Date d1(2024, 4, 14);
	Date d2(2020, 9, 1);
	int n = d1 - d2;
	
	cout << n << endl;
}


void TestDate5()
{
	Date d1(2024, 4, 24);
	Date d2 = d1 + 5000;

	cout << d1;
	cout << d2;

	cin >> d1 >> d2;
	cout << d1 << d2;
}
int main()
{
	TestDate5();

	return 0;

}

🚩总结

请添加图片描述

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

(windows ssh) windows开启ssh服务,并通过ssh登录该win主机

☆ 问题描述 想要通过ssh访问win主句 ★ 解决方案 安装ssh服务 打开服务 如果这里开不来就“打开服务”&#xff0c;找到下面两个开启服务 然后可以尝试ssh链接&#xff0c;注意&#xff0c;账号密码&#xff0c;账号是这个&#xff1a; 密码是这个 同理&#xff0c;如果…

matlab新手快速上手5(蚁群算法)

本文根据一个较为简单的蚁群算法框架详细分析蚁群算法的实现过程&#xff0c;对matlab新手友好&#xff0c;源码在文末给出。 蚁群算法简介&#xff1a; 蚁群算法是一种启发式优化算法&#xff0c;灵感来源于观察蚂蚁寻找食物的行为。在这个算法中&#xff0c;解决方案被看作是…

vue3中的ref、isRef、shallowRef、triggerRef和customRef

1.ref 接受一个参数值并返回一个响应式且可改变的 ref 对象。 ref 对象拥有一个指向内部值的单一属性 .value property &#xff0c;指向内部值。 例&#xff1a;此时&#xff0c;页面上的 str1 也跟着变化 <template><div><button click"handleClick&quo…

BUUCTF-MISC-10.LSB1

10.LSB1 题目&#xff1a;lsb隐写&#xff0c;stegsolve可以看到包含了一个PNG图片 使用stegsolve打开这个图片 由PNG文件头可以看出隐写内容为PNG文件&#xff0c;按save Bin键保存为PNG文件。 得到一张二维码图片&#xff0c;使用CQR扫一下

盲返模式:电商领域的新玩法与商业创新

大家好&#xff0c;我是微三云周丽&#xff0c;今天给大家分析当下市场比较火爆的商业模式&#xff01; 小编今天跟大伙们分享什么是什么是盲返模式&#xff1f; 随着互联网的深入发展&#xff0c;电商行业正面临着前所未有的机遇与挑战。在这个竞争激烈的市场环境中&#xff…

GAN 生成对抗神经网络

GAN 文章目录 GANGAN的结构GAN的目标函数GAN的训练GAN的优势和不足优势不足 GAN的结构 GAN的设计灵感来源于博弈论中的零和博弈&#xff08;Zero-sum Game&#xff09;&#xff0c;在零和博弈中&#xff0c;参与双方的收益是完全相反的&#xff0c;一方的收益必然导致另一 方的…

Python400集 视频教程,手把手带你零基础手写神经网络!!

嗨喽&#xff0c;大家好&#xff0c;今天又要给大家整一波福利了&#xff01; 学习编程&#xff0c;最忌讳就是今天一个教程&#xff0c;明天一个教程&#xff0c;频繁更换教程&#xff0c;增加自己的学习成本&#xff0c;对于新手小白会是一件严重打击自信心的事情。所以今天…

jetson开发板+外接散热风扇

本文参考链接 https://news.mydrivers.com/1/580/580811.htm?refhttps%3A//www.baidu.com/link%3Furl%3DM_D45a-od3NK-ER_Flgqqw4LjHLinB1xrmYNj7VVqHlM2zVXwR9Z7FGilCYDRRJYNpIsdejeAfpVtmVTowuFfK%26wd%3D%26eqid%3D81e7865e000256a5000000046628ff4a 一、三种风扇的种类 二…

全自动装箱机多少钱?它的性能和优势又是怎样的呢?

在现代化的生产线中&#xff0c;全自动装箱机已经成为许多企业提升效率、降低成本的重要设备。那么&#xff0c;全自动装箱机到底多少钱?它的性能和优势又是怎样的呢? 一、全自动装箱机&#xff1a;高效省力的生产助手 全自动装箱机是一种高度自动化的包装设备&#xff0c;能…

掌握未来通信技术:5G核心网基础入门

&#x1f525;个人主页&#xff1a;Quitecoder &#x1f525;专栏&#xff1a;5GC笔记仓 朋友们大家好&#xff0c;本篇文章是我们新内容的开始&#xff0c;我们本篇进入5GC的学习&#xff0c;希望大家多多支持&#xff01; 目录 一.核心网的演进2G核心网2.5G核心网3G核心网4G…

CFCASSL证书的网络安全解决方案

在数字化时代&#xff0c;网络信息安全的重要性不言而喻。随着电子商务、在线交易、远程办公等互联网活动的日益普及&#xff0c;确保数据传输的安全性与隐私保护成为企业和用户共同关注的焦点。在此背景下&#xff0c;CFCA SSL证书作为一种权威、高效的网络安全解决方案&#…

ShardingSphere 5.x 系列【24】集成 Nacos 配置中心

有道无术,术尚可求,有术无道,止于术。 本系列Spring Boot 版本 3.1.0 本系列ShardingSphere 版本 5.4.0 源码地址:https://gitee.com/pearl-organization/study-sharding-sphere-demo 文章目录 1. 前言2. ShardingSphereDriverURLProvider3. 方式一:基于 Nacos Java SDK…

《2024年网络弹性风险指数报告》:92%的组织并未准备好应对AI安全挑战

网络弹性是一个比传统网络安全更大、更重要的范例&#xff0c;拥有有效网络弹性能力的组织能在承受网络攻击、技术故障或故意篡改企图后迅速恢复正常业务运营。近日&#xff0c;Absolute security公司发布的《2024年网络弹性风险指数报告》旨在评估当今全球企业的网络弹性状况&…

【Elasticsearch<一>✈️✈️】简单安装使用以及各种踩坑

目录 &#x1f378;前言 &#x1f37b;一、软件安装&#xff08;Windows版&#xff09; 1.1、Elasticsearch 下载 2.1 安装浏览器插件 3.1、安装可视化工具 Kibana 4.1、集成 IK 分词器 &#x1f37a;二、安装问题 &#x1f379;三、测试 IK 分词器 ​&#x1f377; 四、章…

用斐波那契数列感受算法的神奇(21亿耗时0.02毫秒)

目录 一、回顾斐波那契数列 二、简单递归方法 &#xff08;一&#xff09;解决思路 &#xff08;二&#xff09;代码展示 &#xff08;三&#xff09;性能分析 三、采用递归HashMap缓存 &#xff08;一&#xff09;解决思路 &#xff08;二&#xff09;代码展示 &…

PPSSPPSDL for Mac v1.17.1 PSP游戏模拟器(附500款游戏) 激活版

PPSSPPSDL for Mac是一款模拟器软件&#xff0c;它允许用户在Mac上运行PSP&#xff08;PlayStation Portable&#xff09;游戏。通过这款模拟器&#xff0c;用户可以体验到高清甚至更高的分辨率的游戏画面&#xff0c;同时还能够升级纹理以提升清晰度&#xff0c;并启用后处理着…

新恒盛110kV变电站智能辅助系统综合监控平台+道巡检机器人

江苏晋控装备新恒盛化工有限公司是晋能控股装备制造集团有限公司绝对控股的化工企业&#xff0c;公司位于江苏省新沂市。新恒盛公司40•60搬迁项目在江苏省新沂市经济开发区化工产业集聚区苏化片区建设&#xff0c;总投资为56.64亿元&#xff0c;该项目是晋能控股装备制造集团重…

PEG SPARCL™试剂盒

Life Diagnostics开发了SPARCL™ 试剂盒用于检测甲氧基-PEG&#xff08;mPEG&#xff09;和非甲氧基PEG。可检测游离的PEG和PEG化的蛋白质。灵敏度随PEG链长度和PEG化程度的不同而变化。 SPARCL™检测具有以下特点&#xff1a; ● 发光免疫测定法 ● 只需一次30分钟的孵育 …

快递物流订阅推送API接口如何对接

快递物流订阅推送API接口指的是订阅国内物流快递信息&#xff0c;当运单状态发生变化时&#xff0c;会推送到您的回调地址&#xff0c;直到这些运单号生命周期结束。简单点说就是先订阅快递单号再推送物流信息。那么快递物流订阅推送API接口该如何对接呢&#xff1f; 首先我们…

如何通过香港站群服务器提升跨境电商交易效率?

如何通过香港站群服务器提升跨境电商交易效率? 在全球电子商务迅速发展的今天&#xff0c;跨境电商已成为企业拓展国际市场、获取更多商机的重要途径。然而&#xff0c;跨境电商面临的挑战也不容小觑&#xff0c;尤其是在交易效率方面。利用香港站群服务器&#xff0c;不仅可…