C++(一):基本数据类型

news2024/10/5 15:24:58

基本数据类型

    • 基本内置类型
    • 定义变量
      • `type field = value;`
      • `type field(value);`
      • `type field{value};`
      • `type field = {value};`
    • 数学常量及函数
    • 静态类型转换 `static_cast`
    • 格式化字符串
      • `std::stringstream`
      • `std::string`
      • 引入三方库 `fmt/core.h`
    • 字符运算
    • `auto` 关键字
    • 枚举类型
    • 数据类型定义别名
    • 判断是否为NaN
    • 三向比较运算符(太空飞船运算符)
    • 多维数组
    • 避免幻数
    • 运行期间为数组分配内存空间
    • 数组的替代品
      • `std::array`
      • `std::vector`

基本内置类型

在这里插入图片描述

#include <iostream>

using namespace std;

int main() {
    cout << "数据类型" << "\t\t" << "所占字节" << "\t" << "最小值" << "\t\t\t" << "最大值" << endl;

    cout << "bool(布尔型)" << "\t\t" << sizeof(bool) << "\t\t" << numeric_limits<bool>::min() << "\t\t\t" << numeric_limits<bool>::max() << endl;

    cout << "char(字符型)" << "\t\t" << sizeof(char) << "\t\t" << numeric_limits<char>::min() << "\t\t\t" << numeric_limits<char>::max() << endl;
    cout << "unsigned char" << "\t\t" << sizeof(unsigned char) << "\t" << numeric_limits<unsigned char>::min() << "\t" << numeric_limits<unsigned char>::max() << endl;
    cout << "signed char" << "\t\t" << sizeof(signed char) << "\t\t" << numeric_limits<signed char>::min() << "\t\t\t" << numeric_limits<signed char>::max() << endl;

    cout << "int(整型)" << "\t\t" << sizeof(int) << "\t\t" << numeric_limits<int>::min() << "\t\t" << numeric_limits<int>::max() << endl;
    cout << "unsigned int" << "\t\t" << sizeof(unsigned int) << "\t\t" << numeric_limits<unsigned int>::min() << "\t\t\t" << numeric_limits<unsigned int>::min() << endl;
    cout << "signed int" << "\t\t" << sizeof(signed int) << "\t\t" << numeric_limits<signed int>::min() << "\t\t" << numeric_limits<signed int>::max() << endl;

    cout << "short int" << "\t\t" << sizeof(short int) << "\t\t" << numeric_limits<short int>::min() << "\t\t\t" << numeric_limits<short int>::max() << endl;
    cout << "unsigned short int" << "\t" << sizeof(unsigned short int) << "\t\t" << numeric_limits<unsigned short int>::min() << "\t\t\t" << numeric_limits<unsigned short int>::max() << endl;
    cout << "signed short int" << "\t" << sizeof(signed short int) << "\t\t" << numeric_limits<signed short int>::min() << "\t\t\t" << numeric_limits<signed short int>::max() << endl;

    cout << "long int" << "\t\t" << sizeof(long int) << "\t\t" << numeric_limits<long int>::min() << "\t" << numeric_limits<long int>::max() << endl;
    cout << "unsigned long int" << "\t" << sizeof(unsigned long int) << "\t\t" << numeric_limits<unsigned long int>::min() << "\t\t\t" << numeric_limits<unsigned long int>::max() << endl;
    cout << "signed long int" << "\t\t" << sizeof(signed long int) << "\t\t" << numeric_limits<signed long int>::min() << "\t" << numeric_limits<signed long int>::max() << endl;

    cout << "float(浮点型)" << "\t\t" << sizeof(float) << "\t\t" << numeric_limits<float>::min() << "\t\t" << numeric_limits<float>::max() << endl;

    cout << "double(双浮点型)" << "\t" << sizeof(double) << "\t\t" << numeric_limits<double>::min() << "\t\t" << numeric_limits<double>::max() << endl;

    cout << "long double" << "\t\t" << sizeof(long double) << "\t\t" << numeric_limits<long double>::min() << "\t\t" << numeric_limits<long double>::max() << endl;

    cout << "wchar_t(宽字符型)" << "\t" << sizeof(wchar_t) << "\t\t" << numeric_limits<wchar_t>::min() << "\t\t" << numeric_limits<wchar_t>::max() << endl;

    return 0;
}

定义变量

type field = value;

这是最常见的初始化语法,使用等号来将value赋值给field。这种方式允许发生隐式类型转换,并且不会进行列表初始化检查。

#include <iostream>

using namespace std;

int main() {
    int a = 1;
    int b = 1.5;
    cout << a << endl; // 1
    cout << b << endl; // 1
    return 0;
}

type field(value);

这种初始化方式使用括号进行初始化。它类似于使用等号进行初始化,允许发生隐式类型转换,不进行列表初始化检查。

#include <iostream>

using namespace std;

int main() {
    int a(1);
    int b(1.56);
    cout << a << endl; // 1
    cout << b << endl; // 1
    return 0;
}

type field{value};

这种初始化方式使用花括号,被称为列表初始化。它提供了更严格的类型检查,并且不允许发生窄化转换(narrowing conversion)。如果存在可能发生精度损失或信息丢失的情况,编译器会产生错误。

#include <iostream>

using namespace std;

int main() {
    int a{1}; // int a{1.5}; error
    cout << a << endl; // 1
    return 0;
}

type field = {value};

这种初始化方式也使用等号和花括号,被称为统一初始化。它类似于列表初始化,提供了更严格的类型检查,并且不允许窄化转换。与type field{value}; 的区别在于,等号和花括号之间可以有空格。

#include <iostream>

using namespace std;

int main() {
    int a = {1}; // int a = {1.5}; error
    cout << a << endl; // 1
    return 0;
}

数学常量及函数

在这里插入图片描述

#include <iostream>
#include <numbers>

using namespace std;

int main() {

    cout << "自然对数的底\t\t\t" << numbers::e << endl;
    cout << "圆周率\t\t\t\t" << numbers::pi << endl;
    cout << "2的平方根\t\t\t" << numbers::sqrt2 << endl;
    cout << "黄金比例常量\t\t\t" << numbers::phi << endl;

    cout << "绝对值\t\t\t\t" << abs(-1.23) << endl;
    cout << "大于或等于参数的最小整数\t" << ceil(-1.23) << endl;
    cout << "小于或等于参数的最大整数\t" << floor(-1.23) << endl;
    cout << "计算e^参数\t\t\t" << exp(1) << endl;
    cout << "计算底为e的参数的自然对数\t" << log(exp(1)) << endl;
    cout << "计算底为10的参数的自然对数\t" << log10(100) << endl;
    cout << "幂\t\t\t\t" << pow(2, 10) << endl;
    cout << "平方根\t\t\t\t" << sqrt(9) << endl;
    cout << "四舍五入\t\t\t" << round(-12.54) << endl;

    return 0;
}

静态类型转换 static_cast

强制转换为另一种数据类型的值,转换过程中不进行任何运行时类型检查,因此可能导致运行时错误,通常用于比较类型相似的对象之间的转换,如int转float

#include <iostream>

using namespace std;

int main() {

    float a = 1.23;
    int b = static_cast<int>(a);

    cout << a << " 类型:" << typeid(a).name() << endl; // 1.23    类型:f
    cout << b << " 类型:" << typeid(b).name() << endl; // 1       类型:i

    return 0;
}

格式化字符串

std::stringstream

#include <iostream>
#include <sstream>

using namespace std;

int main() {

    int age = 18;

    char name[] = "Lee";

    stringstream msg;

    msg << "Hello, " << name << "!!! " << age << "!!!";

    cout << msg.str() << endl; // Hello, Lee!!! 18!!!

    return 0;
}

std::string

#include <iostream>

using namespace std;

int main() {

    int age = 18;

    string name = "Lee";

    string msg = "Hello, " + name + "!!! " + to_string(age) + "!!!";

    cout << msg << endl; // Hello, Lee!!! 18!!!

    return 0;
}

引入三方库 fmt/core.h

下载

https://github.com/fmtlib/fmt.git

在这里插入图片描述

引入 c-app/CMakeLists.txt

cmake_minimum_required(VERSION 3.25)
project(c_app)

set(CMAKE_CXX_STANDARD 20)

add_executable(c_app ../main.cpp)

# 添加fmt库目录
add_subdirectory(../libs/fmt-10.0.0)

# 链接fmt库
target_link_libraries(c_app fmt::fmt)

运行

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    char name[] = "Lee";

    double height = 1.8123456;

    int age = 18;

    string msg = fmt::format("Hello, {}! Height: {:.2f}! Age: {}!", name, height, age);

    cout << msg << endl; // Hello, Lee! Height: 1.81! Age: 18!

    return 0;
}

字符运算

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    char word = 'A';

    string msg = fmt::format("字符: {} \n表示字符的整数代码: {} \n整数转字符: {}", word, word + 1, static_cast<char>(word + 2));

    /**
     * 字符: A
     * 表示字符的整数代码: 66
     * 整数转字符: C
     */
    cout << msg << endl;

    return 0;
}

auto 关键字

用于自动推断变量类型

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    auto a = 1;
    auto b = {2};
    auto c{3};

    /**
     * a: i
     * b: St16initializer_listIiE
     * c: i
     */
    cout << fmt::format("a: {}\nb: {}\nc: {}", typeid(a).name(), typeid(b).name(), typeid(c).name()) << endl;

    return 0;
}

枚举类型

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

/**
 * 枚举类型Color
 */
enum class Color {
    red, green = 3, blue
} color;

/**
 * 枚举类型Mode
 */
enum class Mode : char {
    create = 'C',
    del = 'D',
    edit = 'U',
    search = 'Q'
};

int main() {

    cout << static_cast<int>(color) << endl; // 0

    color = Color::red;
    cout << static_cast<int>(color) << endl;  // 0

    color = Color::green;
    cout << static_cast<int>(color) << endl;  // 3

    color = Color::blue;
    cout << static_cast<int>(color) << endl;  // 4

    Color c1 = Color::red;
    Color c2 = Color::green;
    Color c3 = Color::blue;
    cout << fmt::format("c1: {}, c2: {}, c3: {}", static_cast<int>(c1), static_cast<int>(c2), static_cast<int>(c3)) << endl; // c1: 0, c2: 3, c3: 4

    Mode mode{Mode::edit};

    cout << fmt::format("mode: {}, {}", static_cast<char>(mode), static_cast<int>(mode)) << endl; // mode: U, 85

    return 0;
}

数据类型定义别名

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

// 别名方式1
using str1 = std::string;

// 别名方式2
typedef char str2;

int main() {

    str1 say = "Hello";
    str2 name[] = "Lee";

    std::cout << fmt::format("{}, {}!!!", say, name) << std::endl; // Hello, Lee!!!

    return 0;
}

判断是否为NaN

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"
#include <numbers>

using namespace std;

int main() {

    double pi = numbers::pi;

    double num = sqrt(-1);

    cout << fmt::format("pi: {}, num: {}", pi, num) << endl; // pi: 3.141592653589793, num: nan
    cout << fmt::format("pi: {}, num: {}", isnan(pi), isnan(num)) << endl; // pi: false, num: true

    return 0;
}

三向比较运算符(太空飞船运算符)

  • a <=> b 返回枚举类型
    • equal(等于)
    • equivalent(等于)
    • greater(大于)
    • less(小于)
    • unordered(NaN相等)
比较类型lessgreaterequalequivalentunordered用于
strong_orderingYESYESYESYESNO整数和指针
partial_orderingYESYESNOYESYES浮点数
weak_orderingYESYESNOYESNO仅用于用户自定义的运算符
#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    double a = numeric_limits<double>::quiet_NaN(); // nan
    double b = numeric_limits<double>::quiet_NaN(); // nan

    partial_ordering c{a <=> b};

    if (c == strong_ordering::equal) {
        cout << "a = b" << endl;
    } else if (c == strong_ordering::equivalent) {
        cout << "两个值在强序比较中是等价的" << endl;
    } else if (c == strong_ordering::greater) {
        cout << "a > b" << endl;
    } else if (c == strong_ordering::less) {
        cout << "a < b" << endl;
    }

    if (c == partial_ordering::unordered) {
        cout << fmt::format("a: {}, b: {}", isnan(a), isnan(b)) << endl; // a: true, b: true
    }

    if (is_eq(c)) {
        cout << "a = b" << endl;
    }

    if (is_gt(c)) {
        cout << "a > b" << endl;
    }

    if (is_gteq(c)) {
        cout << "a >= b" << endl;
    }

    if (is_lt(c)) {
        cout << "a < b" << endl;
    }

    if (is_lteq(c)) {
        cout << "a <= b" << endl;
    }

    return 0;
}

多维数组

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    int list[3][3] = {
            {1, 2, 3},
            {4, 5, 6},
            {7, 8, 9}
    };

    for (int i = 0; i < size(list); ++i) {
        for (int j = 0; j < size(list[i]); ++j) {
            cout << fmt::format("{} ", list[i][j]); // 1 2 3 4 5 6 7 8 9
        }
    }

    for (auto &a: list) {
        for (int b: a) {
            cout << fmt::format("{} ", b); // 1 2 3 4 5 6 7 8 9
        }
    }

    return 0;
}

避免幻数

幻数是指在代码中直接使用一些未经解释的常数值,这样的代码可读性较差,且不易于维护和理解,示例如下:

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    int list[3]{1, 2, 3};

    for (int i = 0; i < size(list) + 5; ++i) {
        /**
         * 结果:
         *      1 2 3 1 -1445723955 -250088645 0 0
         *      1 2 3 1 1461452947 457358528 0 0
         *      1 2 3 1 805896392 1713566091 0 0
         */
        cout << fmt::format("{} ", list[i]);
    }

    return 0;
}

运行期间为数组分配内存空间

可变的数组长度

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    int count;

    cin >> count; // 8

    int list[count];

    for (int i = 0; i < count; ++i) {
        list[i] = i + 1;
    }

    for (int num: list) {
        cout << fmt::format("{} ", num); // 1 2 3 4 5 6 7 8
    }

    return 0;
}

数组的替代品

std::array

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    /* ========= list1 =========*/

    array<int, 5> list1 = {1, 2, 3, 4, 5};

    for (int d: list1) {
        cout << d; // 1 2 3 4 5
    }

    /* ========= list2 =========*/

    auto list2 = array{1, 2, 3, 4, 5}; // 根据值推断模版参数

    cout << list2.size(); // 5

    cout << list2.at(3); // 4

    cout << list2[2]; // 3

    list2.fill(3);

    for (double d: list2) {
        cout << d; // 3 3 3 3 3
    }

    return 0;
}

比较

  • 相等比较每个元素均相等
  • 不等只要存在不等即不等
  • 大于第一个元素进行比较然后返回对应判断
  • 小于第一个元素进行比较然后返回对应判断
#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    array<int, 5> l = {1, 2, 3, 4, 5};

    array<int, 5> a = {1, 2, 3, 4, 5}; // l == a
    array<int, 5> b = {5, 4, 3, 2, 1}; // l < b
    array<int, 5> c = {3, 2, 1, 5, 4}; // l < c
    array<int, 5> d = {6, 6, 6, 6, 6}; // l < d
    array<int, 5> e = {0, 0, 1, 0, 0}; // l > e

    return 0;
}

std::vector

#include <iostream>
#include "libs/fmt-10.0.0/include/fmt/core.h"

using namespace std;

int main() {

    /* ====== list1 ====== */

    vector<int> list1 = {1, 2, 3, 4, 5};

    // push一个元素
    list1.push_back(6);

    // 数组长度
    cout << list1.size() << endl; // 6

    for (int num: list1) {
        cout << num; // 1 2 3 4 5 6
    }

    // 删除最后一个元素
    list1.pop_back();

    for (int num: list1) {
        cout << num; // 1 2 3 4 5
    }

    /* ====== list2 ====== */

    vector list2(1, 6); // 1 到 6

    for (int num: list2) {
        cout << num; // 1 2 3 4 5 6
    }

    list2.assign(3, 1); // 3 个 1

    for (int num: list2) {
        cout << num; // 1 1 1
    }

    list2.assign({6, 2, 3, 4, 5});

    for (int num: list2) {
        cout << num; // 6 2 3 4 5
    }

    /* ====== list3 ====== */

    vector<int> list3{7, 6, 2, 3, 3, 6, 3, 8};

    erase(list3, 3);
    for (int num: list3) {
        cout << num; // 7 6 2 6 8
    }

    list3.empty(); // 清空但保留长度
    cout << list3.size(); // 5

    list3.clear(); // 清空
    cout << list3.size(); // 0

    return 0;
}

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

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

相关文章

牛客网刷题之链表(一)

链表 NB1 删除链表峰值NB2 牛群排列去重NB3 调整牛群顺序NB4 牛群的重新分组NB5 牛群的重新排列NB6 合并两群能量值&#xff08;合并有序单链表&#xff09;NB7 牛群的能量值&#xff08;单链表相加&#xff09; 以下题全部出自牛客网。 题目题目考察的知识点链表&#xff1a; …

Element Plus 日期选择器

计算开始日期到结束日期的总天数 结构 <el-form-item label"计划开始时间" required prop"StartTime"><el-date-pickertype"date"v-model"ruleForm.StartTime":disabled-date"StartTime"placeholder"计划开始…

pytorch工具——使用pytorch构建一个分类器

目录 分类器任务和数据介绍训练分类器的步骤在GPU上训练模型 分类器任务和数据介绍 训练分类器的步骤 #1 import torch import torchvision import torchvision.transforms as transformstransformtransforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5,0.5,0.…

SpringCloud学习路线(8)—— Docker

一、Docker的开始 &#xff08;一&#xff09;项目部署问题&#xff1a; 依赖关系复杂&#xff0c;容易出现兼容性问题开发、测试、生产环境有差异 &#xff08;二&#xff09;Docker如何解决问题&#xff1f; 1、依赖兼容问题 &#xff08;1&#xff09;将应用的Libs&…

垃圾回收之三色标记法(Tri-color Marking)

关于垃圾回收算法&#xff0c;基本就是那么几种&#xff1a;标记-清除、标记-复制、标记-整理。在此基础上可以增加分代&#xff08;新生代/老年代&#xff09;&#xff0c;每代采取不同的回收算法&#xff0c;以提高整体的分配和回收效率。 无论使用哪种算法&#xff0c;标记…

(已解决)RuntimeError: Java gateway process exited before sending its port number

今天用Pycharm远程使用pysaprk解释器时&#xff0c;跑代码出现了这个错误&#xff1a; RuntimeError: Java gateway process exited before sending its port number 找了好多博客都没解决问题&#xff0c;有说重装spark的&#xff0c;有说本地配Java_home的&#xff0c;后面我…

[C语言刷题]杨氏矩阵、返回型参数

本文包含知识点 杨氏矩阵极其解法函数return多个值的四种方法 题目&#xff1a; 杨氏矩阵 有一个数字矩阵&#xff0c;矩阵的每行从左到右是递增的&#xff0c;矩阵从上到下是递增的&#xff0c;请编写程序在这样的矩阵中查找某个数字是否存在。 要求&#xff1a;时间复杂度小于…

js 在浏览器窗口关闭后还可以不中断网络请求

有个需求&#xff0c;我们需要在用户发送数据过程中&#xff0c;如果用户关闭了网页(包括整个浏览器关闭)&#xff0c;不要中断数据传递 目前XMLHttpRequest对象是不支持的 http服务器 为了测试效果我们用nodejs写了个http服务器代码 文件名为httpServer.js如下&#xff0c;…

获取大疆无人机的飞控记录数据并绘制曲线

机型M350RTK&#xff0c;其飞行记录文件为加密的&#xff0c;我的完善代码如下 gitgithub.com:huashu996/DJFlightRecordParsing2TXT.git 一、下载安装官方的DJIFlightRecord git clone gitgithub.com:dji-sdk/FlightRecordParsingLib.git飞行记录文件在打开【我的电脑】&am…

Windows nvm 安装后webstrom vue项目编译报错,无法识别node

1 nvm安装流程 卸载原先nodejs用管理员权限打开exe安装nvmnvm文件夹和nodejs文件夹 都授权Authenticated Users 完全控制nvm list availablenvm install 16.20.1nvm use 16.20.1输入node和npm检查版本命令&#xff0c;正常显示确认系统变量和用户变量都有nvm 和nodejs 2 bug情…

数学建模-聚类算法 系统(层次)聚类

绝对值距离:网状道路 一般用组间和组内距离 聚类的距离计算如何选取&#xff1a;看结果是否解释的通&#xff0c;选择一种结果解释的通的方法。

【数据挖掘】将NLP技术引入到股市分析

一、说明 在交易中实施的机器学习模型通常根据历史股票价格和其他定量数据进行训练&#xff0c;以预测未来的股票价格。但是&#xff0c;自然语言处理&#xff08;NLP&#xff09;使我们能够分析财务文档&#xff0c;例如10-k表格&#xff0c;以预测股票走势。 二、对自然语言处…

【转载+修改】pytorch中backward求梯度方法的具体解析

原则上&#xff0c;pytorch不支持张量对张量的求导&#xff0c;它只支持标量对张量的求导 我们先看标量对张量求导的情况 import torch xtorch.ones(2,2,requires_gradTrue) print(x) print(x.grad_fn)输出&#xff0c;由于x是被直接创建的&#xff0c;也就是说它是一个叶子节…

Vue.js uni-app 混合模式原生App webview与H5的交互

在现代移动应用开发中&#xff0c;原生App与H5页面之间的交互已经成为一个常见的需求。本文将介绍如何在Vue.js框架中实现原生App与H5页面之间的数据传递和方法调用。我们将通过一个简单的示例来展示如何实现这一功能。附完整源码下载地址:https://ext.dcloud.net.cn/plugin?i…

Java集成openAi的ChatGPT实战

效果图&#xff1a; 免费体验地址&#xff1a;AI智能助手 具体实现 public class OpenAiUtils {private static final Log LOG LogFactory.getLog(OpenAiUtils.class);private static OpenAiProxyService openAiProxyService;public OpenAiUtils(OpenAiProxyService openAiP…

【C++】入门 --- 命名空间

文章目录 &#x1f36a;一、前言&#x1f369;1、C简介&#x1f369;2、C关键字 &#x1f36a;二、命名冲突&#x1f36a;三、命名空间&#x1f369;1、命名空间定义&#x1f369;2、命名空间的使用 &#x1f36a;四、C输入&输出 &#x1f36a;一、前言 本篇文章是《C 初阶…

Data Transfer Object-DTO,数据传输对象,前端参数设计多个数据表对象

涉及两张表的两个实体对象 用于在业务逻辑层和持久层&#xff08;数据库访问层&#xff09;之间传输数据。 DTO的主要目的是将多个实体&#xff08;Entity&#xff09;的部分属性或多个实体关联属性封装成一个对象&#xff0c;以便在业务层进行数据传输和处理&#xff0c;从而…

八、HAL_UART(串口)的接收和发送

1、开发环境 (1)Keil MDK: V5.38.0.0 (2)STM32CubeMX: V6.8.1 (3)MCU: STM32F407ZGT6 2、UART和USART的区别 2.1、UART (1)通用异步收发收发器&#xff1a;Universal Asynchronous Receiver/Transmitter)。 2.2、USART (1)通用同步异步收发器&#xff1a;Universal Syn…

【《R4编程入门与数据科学实战》——一本“能在日常生活中使用统计学”的书】

《R 4编程入门与数据科学实战》的两名作者均为从事编程以及教育方面的专家&#xff0c;他们用详尽的语言&#xff0c;以初学者的角度进行知识点的讲解&#xff0c;每个细节都手把手教学,以让读者悉数掌握所有知识点&#xff0c;在每章的结尾都安排理论与实操相结合的习题。与同…

banner轮播图实现、激活状态显示和分类列表渲染、解决路由缓存问题、使用逻辑函数拆分业务(一级分类)【Vue3】

一级分类 - banner轮播图实现 分类轮播图实现 分类轮播图和首页轮播图的区别只有一个&#xff0c;接口参数不同&#xff0c;其余逻辑完成一致 适配接口 export function getBannerAPI (params {}) {// 默认为1 商品为2const { distributionSite 1 } paramsreturn httpIn…