(C语言)超市管理系统 (正式版)(指针)(数据结构)(清屏操作)(文件读写)(网页版预告)(html)(js)(json)

news2025/5/18 13:24:10

目录

前言:

源代码:

product.h

 product.c

 fileio.h

 fileio.c

 main.c

json_export.h 

 json_export.c

 tasks.json

 idex.html

 script.js

 相关步骤:

第一步:

第二步:

 第三步:

 第四步:

第五步:

第六步:

运行结果:


前言:

当前这篇博客是预告,基于上篇博客超市管理系统基础上来写的网页版,今天只是展示:

(C语言)超市管理系统 (正式版)(指针)(数据结构)(清屏操作)(文件读写)-CSDN博客

看之前建议先看测试版博客:

(C语言)超市管理系统(测试版)(指针)(数据结构)(二进制文件读写)-CSDN博客

如果大家对前端(html,js,json)有兴趣,后续可以教大家一些,我也只是略懂一二 

共13个文件(加上二进制文件);

源代码:

product.h

#pragma once // 防止头文件重复定义

#define NAME_LEN 50 // 商品名称最大容量

// 单个商品结构体
typedef struct {
    int id;         // 商品编号
    char name[NAME_LEN]; // 商品名字
    float price;    // 商品单价
    int stock;      // 商品库存
} Product;

// 商品列表表结构体
typedef struct {
    Product* Data;  // 指向单个商品数组的指针
    int count;      // 当前商品数量
} ProductList;

// 函数原型
void Init_products(ProductList* list);      // 初始化商品列表结构体
void add_product(ProductList* list, Product* product); // 添加单个商品
void display_products(ProductList* list);   // 显示所有商品
void mod_product(ProductList* list);        // 修改单个商品
void del_product(ProductList* list);        // 删除单个商品
void que_product(ProductList* list);        // 查询单个商品

 product.c

#include "product.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// 初始化商品列表结构体
void Init_products(ProductList* list) {
    list->Data = NULL; // 指针置空,防止野指针
    list->count = 0;   // 商品数量归0
}

// 添加单个商品
void add_product(ProductList* list, Product* product) {
    // 1. 扩展空间
    Product* listnew_Data = realloc(list->Data, (list->count + 1) * sizeof(Product));
    if (listnew_Data == NULL) {
        printf("内存分配失败!\n");
        exit(EXIT_FAILURE);
    }
    list->count++; // 商品数量加一
    list->Data = listnew_Data; // 依然用老数组表示描述

    // 2. ID自动生成
    list->Data[list->count - 1].id = list->count; // 利用商品当前数量赋值ID
    printf("商品ID:%d\n", list->count);

    // 3. 商品信息录入
    printf("请输入商品名称:");
    scanf("%49s", list->Data[list->count - 1].name);
    printf("请输入单价:");
    scanf("%f", &list->Data[list->count - 1].price);
    printf("请输入库存:");
    scanf("%d", &list->Data[list->count - 1].stock);
    printf("添加成功!\n");
}

// 显示所有商品
void display_products(ProductList* list) {
    // 1. 判断列表是否为空
    if (list->count == 0) {
        printf("库存为空\n");
        return;
    }

    // 2. 打印表头
    printf("\n%5s %-20s %10s %6s\n", "ID", "名称", "单价", "库存");
    printf("--------------------------------------------\n");

    // 3. 打印商品信息
    for (int i = 0; i < list->count; i++) { // 遍历商品列表
        printf("%5d %-20s %10.2f %5d\n",
            list->Data[i].id,
            list->Data[i].name,
            list->Data[i].price,
            list->Data[i].stock);
    }
}

// 修改单个商品
void mod_product(ProductList* list) {
    // 1. 判断列表是否为空
    if (list->count == 0) {
        printf("库存为空\n");
        return;
    }

    // 2. 输入要修改的ID
    int id_0;
    printf("请输入要修改的ID:");
    scanf("%d", &id_0);

    // 3. 判断ID是否存在
    if (id_0 > list->count) {
        printf("ID不存在!\n");
        return;
    }

    // 4. 找要修改商品的ID
    int i = 0;
    for (i; i < list->count; i++) {
        if (id_0 == list->Data[i].id) { // 此时的i+1就是当前商品ID
            break;
        }
    }

    // 5. 修改商品
    printf("\n%5s %-20s %10s %6s\n", "ID", "名称", "单价", "库存");
    printf("--------------------------------------------\n");
    printf("%5d %-20s %10.2f %5d\n",
        list->Data[i].id,
        list->Data[i].name,
        list->Data[i].price,
        list->Data[i].stock);
    printf("--------------------------------------------\n");
    printf("修改商品名称:");
    scanf("%49s", list->Data[i].name);
    printf("修改单价:");
    scanf("%f", &list->Data[i].price);
    printf("修改库存:");
    scanf("%d", &list->Data[i].stock);
    printf("修改成功!\n");
}

// 删除单个商品
void del_product(ProductList* list) {
    // 1. 显示所有商品
    display_products(list);
    printf("--------------------------------------------\n");

    // 2. 输入要删除的ID
    int id_0;
    printf("请输入要删除的ID:");
    scanf("%d", &id_0);

    // 3. 判断ID是否存在
    if (id_0 > list->count) {
        printf("ID不存在!\n");
        return;
    }

    // 4. 找要删除商品的ID
    int i = 0;
    for (i; i < list->count; i++) { // 此时的i+1就是当前商品ID
        if (id_0 == list->Data[i].id) {
            break;
        }
    }

    // 5. 删除商品
    for (int j = i; j < list->count - 1; j++) {
        list->Data[j] = list->Data[j + 1];
    }
    printf("删除成功!\n");
    list->count--; // 商品数量减一

    // 6. 重新生成商品ID
    if (list->count == 1) {
        list->Data[0].id = 1;
    }
    else {
        list->Data[list->count - 1].id = list->Data[list->count - 2].id + 1;
    }
}

// 查询单个商品
void que_product(ProductList* list) {
    // 1. 判断列表是否为空
    if (list->count == 0) {
        printf("库存为空\n");
        return;
    }

    // 2. 输入要搜索的ID
    int id_0;
    printf("请输入要搜索的ID:");
    scanf("%d", &id_0);

    // 3. 判断ID是否存在
    if (id_0 > list->count) {
        printf("ID不存在!\n");
        return;
    }

    // 4. 找要搜索商品的ID
    int i = 0;
    for (i; i < list->count; i++) {
        if (id_0 == list->Data[i].id) { // 此时的i+1就是当前商品ID
            break;
        }
    }

    // 5. 显示商品
    printf("搜索成功!\n");
    printf("\n%5s %-20s %10s %6s\n", "ID", "名称", "单价", "库存");
    printf("--------------------------------------------\n");
    printf("%5d %-20s %10.2f %5d\n",
        list->Data[i].id,
        list->Data[i].name,
        list->Data[i].price,
        list->Data[i].stock);
}

 fileio.h

#pragma once
#include "product.h"

// 文件操作函数原型
void save_to_file(const char* filename, const ProductList* list);
void load_from_file(const char* filename, ProductList* list);

 fileio.c

#include <stdio.h>
#include <stdlib.h>
#include "product.h"

// 保存数据到文件(二进制写入)
void save_to_file(const char* filename, const ProductList* list) {
    // 1. 打开文件(二进制写入模式)
    FILE* fp = fopen(filename, "wb");
    if (!fp) { // fp == NULL 表示打开失败
        perror("保存失败"); // 输出错误信息(包含具体原因,如权限不足)
        exit(EXIT_FAILURE); // 终止程序,EXIT_FAILURE 表示异常退出
    }

    // 2. 先写入商品数量(int 类型)
    fwrite(&list->count, sizeof(int), 1, fp);

    // 3. 再写入所有商品数据(Product 结构体数组)
    fwrite(list->Data, sizeof(Product), list->count, fp);

    // 4. 关闭文件
    fclose(fp);
}

// 从文件加载数据(二进制读取)
void load_from_file(const char* filename, ProductList* list) {
    // 1. 初始化结构体(防御性编程)
    Init_products(list); // 初始化商品列表结构体

    // 2. 尝试打开文件(二进制读取模式)
    FILE* fp = fopen(filename, "rb"); // "rb":二进制读取模式,文件不存在时返回 NULL
    if (!fp) { // 文件打开失败处理
        return; // 保持 list 的初始状态(count=0, Data=NULL)
    }

    // 3. 读取商品数量(int 类型)
    fread(&list->count, sizeof(int), 1, fp);

    // 4. 根据数量分配内存
    list->Data = (Product*)malloc(list->count * sizeof(Product));
    if (list->Data == NULL) { // list->Data == NULL 表示失败
        printf("内存分配失败\n");
        exit(EXIT_FAILURE); // 终止程序
    }

    // 5. 读取所有商品数据
    fread(list->Data, sizeof(Product), list->count, fp);

    // 6. 关闭文件
    fclose(fp);
}

 main.c

#include <stdio.h>
#include <stdlib.h>
#include "product.h"
#include "fileio.h"
#include "json_export.h"

#define FILENAME "products.dat" // 宏定义文件名

// 清屏操作
void clear_screen() {
#ifdef _WIN32
    system("cls");
#else
    system("clear");
#endif
}

// 显示主菜单(用户界面)
void display_menu() {
    printf("\n超市管理系统\n");
    printf("1. 添加商品\n");
    printf("2. 显示所有商品\n");
    printf("3. 修改商品信息\n");
    printf("4. 删除商品\n");
    printf("5. 搜索商品\n");
    printf("6. 保存并退出\n");
    printf("7. 导出为 JSON\n"); // 新增 JSON 导出选项
    printf("请选择操作:");
}

int main() {
    // 1. 创建结构体并初始化
    Product product; // 创建单个商品结构体
    ProductList list; // 创建商品列表结构体
    Init_products(&list); // 初始化

    // 2. 读文件
    load_from_file(FILENAME, &list); // 读文件

    // 3. 选择模块
    int choice; // 选择选项
    while (1) {
        display_menu(); // 显示菜单
        scanf("%d", &choice); // 输入选项

        switch (choice) {
        case 1:
            clear_screen();
            add_product(&list, &product);
            printf("--------------------------------------------\n");
            break;
        case 2:
            clear_screen();
            display_products(&list);
            printf("--------------------------------------------\n");
            break;
        case 3:
            clear_screen();
            mod_product(&list);
            printf("--------------------------------------------\n");
            break;
        case 4:
            clear_screen();
            del_product(&list);
            printf("--------------------------------------------\n");
            break;
        case 5:
            clear_screen();
            que_product(&list);
            printf("--------------------------------------------\n");
            break;
        case 6:
            save_to_file(FILENAME, &list); // 保存数据
            free(list.Data); // 释放动态内存
            printf("系统已退出\n");
            return 0; // 正确退出
        case 7: {
            clear_screen();
            export_products_to_json(&list); // 正确调用导出函数
            printf("--------------------------------------------\n");
            break;
        }
        default:
            printf("无效输入\n");
        }
    }
}

json_export.h 

#pragma once
#include "product.h"

// 导出商品列表为 JSON 文件
void export_products_to_json(const ProductList* list);

 json_export.c

#include "json_export.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// 导出商品列表为 JSON 文件
void export_products_to_json(const ProductList* list) {
    if (list->count == 0) {
        printf("当前没有商品数据可导出!\n");
        return;
    }

    // 打开 JSON 文件(覆盖模式)
    FILE* json_file = fopen("products.json", "w");
    if (!json_file) {
        perror("无法创建 JSON 文件");
        exit(EXIT_FAILURE);
    }

    // 写入 JSON 数组开头
    fprintf(json_file, "[\n");

    // 遍历所有商品
    for (int i = 0; i < list->count; i++) {
        const Product* p = &list->Data[i];

        // 写入商品对象
        fprintf(json_file, "  {\n");
        fprintf(json_file, "    \"id\": %d,\n", p->id);
        fprintf(json_file, "    \"name\": \"%s\",\n", p->name);
        fprintf(json_file, "    \"price\": %.2f,\n", p->price);
        fprintf(json_file, "    \"stock\": %d\n", p->stock);

        // 非最后一个商品添加逗号
        if (i < list->count - 1) {
            fprintf(json_file, "  },\n");
        } else {
            fprintf(json_file, "  }\n");
        }
    }

    // 写入 JSON 数组结尾
    fprintf(json_file, "]");
    fclose(json_file);
    printf("JSON 文件已生成:products.json\n");
}

 tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "编译 C 程序", // 关键:任务名
            "type": "shell",
            "command": "gcc",
            "args": [
                "-o",
                "supermarket",
                "main.c",
                "product.c",
                "fileio.c",
                "json_export.c"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": ["$gcc"]
        }
    ]
}

 idex.html

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>超市商品展示</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 20px auto;
            padding: 20px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        th, td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #e0e0e0;
        }
        th {
            background-color: #f5f5f5;
            font-weight: 600;
        }
        tr:hover {
            background-color: #f9f9f9;
        }
        .no-data {
            text-align: center;
            padding: 20px;
        }
    </style>
</head>
<body>
    <h1>双叶超市商品列表</h1>
    <table id="productTable">
        <thead>
            <tr>
                <th>商品 ID</th>
                <th>商品名称</th>
                <th>单价(元)</th>
                <th>库存</th>
            </tr>
        </thead>
        <tbody>
            <!-- 商品数据将在此动态填充 -->
        </tbody>
    </table>

    <script src="script.js"></script>
</body>
</html>

 script.js

// 页面加载完成后执行
document.addEventListener('DOMContentLoaded', async () => {
    try {
        // 读取本地 JSON 文件(需通过 Live Server 启动才能正常读取)
        const response = await fetch('products.json');
        if (!response.ok) throw new Error('文件读取失败');

        const products = await response.json();
        renderProducts(products); // 渲染商品表格
    } catch (error) {
        const tbody = document.querySelector('#productTable tbody');
        tbody.innerHTML = `<tr class="no-data"><td colspan="4">${error.message}</td></tr>`;
    }
});

// 渲染商品列表到表格
function renderProducts(products) {
    const tbody = document.querySelector('#productTable tbody');
    tbody.innerHTML = ''; // 清空原有内容

    if (products.length === 0) {
        tbody.innerHTML = '<tr class="no-data"><td colspan="4">当前没有商品数据</td></tr>';
        return;
    }

    products.forEach(product => {
        const row = document.createElement('tr');
        row.innerHTML = `
            <td>${product.id}</td>
            <td>${product.name}</td>
            <td>¥${product.price.toFixed(2)}</td>
            <td>${product.stock}</td>
        `;
        tbody.appendChild(row);
    });
}

 相关步骤:

第一步:

下载VS code:Visual Studio Code - Code Editing. Redefined

第二步:

下载安装后,下载插件(一共九个):

 第三步:

建立一个文件夹(主文件夹名字自己起):

 第四步:

按照第三步复制代码到文件里,注意文件层次:

supermarket - project/
├──.vscode/
│   └── tasks.json
├── output/
├── fileio.c
├── fileio.h
├── index.html
├── json_export.c
├── json_export.h
├── main.c
├── product.c
├── product.h
├── products.dat(提前自己建立)
├── products.json(自动生成)
├── script.js
└── supermarket.exe(自动生成)

第五步:

1.打开 VS Code 的设置。你可以通过点击菜单栏中的 文件 -> 首选项 -> 设置 来打开设置页面。

在设置页面的搜索框中输入 C_Cpp.default.compilerPath

在搜索结果中,找到 C/C++: Default Compiler Path 这个设置项,并确保它的值是你的 GCC 编译器的路径。

点击 “在 settings.json 中编辑”,此时会打开 settings.json 文件。

在 settings.json 文件中添加以下内容(假设 GCC 路径为 C:\mingw64\bin\gcc.exe,若实际路径不同需调整):

"C_Cpp.default.compilerPath": "C:\\mingw64\\bin\\gcc.exe"

保存 settings.json 文件。按 Ctrl+Shift+P,输入 Reload Window(重新加载窗口)。

2.编译超市管理系统,生成takes.json文件:

此时有这些文件就可(当然你粘贴完也不是不行):

按 Ctrl+Shift+P,输入 Tasks: Open Task File,选择 tasks.json(若无则创建粘贴)

3.运行超市管理系统,生成exe文件和products.json

按 Ctrl+Shift+B,选择 “编译 C 程序”,生成exe文件,在终端输入 supermarket(或 supermarket.exe,取决于系统)运行程序(如果不行,直接在文件管理器打开也行),添加些商品,然后选择7,生成json文件

第六步:

复制粘贴html和js文件,在 VS Code 中打开 index.html,右键点击页面空白处,选择 “Open with Live Server”。浏览器会自动打开 http://localhost:5500,显示商品列表。

运行结果:

 注:该代码是本人自己所写,可能不够好,不够简便,欢迎大家指出我的不足之处。如果遇见看不懂的地方,可以在评论区打出来,进行讨论,或者联系我。上述内容全是我自己理解的,如果你有别的想法,或者认为我的理解不对,欢迎指出!!!如果可以,可以点一个免费的赞支持一下吗?谢谢各位彦祖亦菲!!!!!

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

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

相关文章

进阶-数据结构部分:​​​​​​​2、常用排序算法

飞书文档https://x509p6c8to.feishu.cn/wiki/FfpIwIPtviMMb4kAn3Sc40ABnUh 常用排序算法 这几种算法都是常见的排序算法&#xff0c;它们的优劣和适用场景如下&#xff1a; 冒泡排序&#xff08;Bubble Sort&#xff09;&#xff1a;简单易懂&#xff0c;时间复杂度较高&…

25、DeepSeek-R1论文笔记

DeepSeek-R1论文笔记 1、研究背景与核心目标2、核心模型与技术路线3、蒸馏技术与小模型优化4、训练过程简介5、COT思维链&#xff08;Chain of Thought&#xff09;6、强化学习算法&#xff08;GRPO&#xff09;7、冷启动**1. 冷启动的目的****2. 冷启动的实现步骤****3. 冷启动…

LeetCode --- 156双周赛

题目列表 3541. 找到频率最高的元音和辅音 3542. 将所有元素变为 0 的最少操作次数 3543. K 条边路径的最大边权和 3544. 子树反转和 一、找到频率最高的元音和辅音 分别统计元音和辅音的出现次数最大值&#xff0c;然后相加即可&#xff0c;代码如下 // C class Solution {…

npm 报错 gyp verb `which` failed Error: not found: python2 解决方案

一、背景 npm 安装依赖报如下错&#xff1a; gyp verb check python checking for Python executable "python2" in the PATH gyp verb which failed Error: not found: python2 一眼看过去都觉得是Python环境问题&#xff0c;其实并不是你python环境问题&#xf…

初识Linux · IP协议· 下

目录 前言&#xff1a; 内网IP和公网IP 内网IP 公网IP 路由 前言&#xff1a; 前文我们介绍了IP协议的协议头&#xff0c;通过源码等方式我们理解了IP协议中的字段&#xff0c;比如8位协议&#xff0c;比如通过环回问题引出的8位最大生存时间&#xff0c;比如8位协议&…

JAVA的常见API文档(上)

游戏打包 注意API文档中的方法不需要记忆&#xff01;&#xff01; 了解之后如果需要可以查询API文档 对Math的方法总结&#xff1a; 运用刚学的Math方法加快代码的运行效率 可以减少循环次数 找规律&#xff1a; 发现因子有规律&#xff1a; 必定一个大于平方根&#xff0c;…

Spark,连接MySQL数据库,添加数据,读取数据

连接数据库 可以看到shell中我们读取出的数据 在IDEA中打代码如果能输出跟shell中一样的结果即证明连接成功 【出错反思】 像我前面出错的原因就是在打代码时将密码输入错误 添加数据 读取数据就是在上面代码中一起展示了&#xff0c;这里我就不单独说了

【EDA软件】【联合Modelsim仿真使用方法】

背景 业界EDA工具仿真功能是必备的&#xff0c;例如Vivado自带仿真工具&#xff0c;且无需联合外部仿真工具&#xff0c;例如MoodelSim。 FUXI工具仿真功能需要联合Modelsim&#xff0c;才能实现仿真功能。 方法一&#xff1a;FUXI联合ModelSim 1 添加testbench文件 新建to…

【离散化 线段树】P3740 [HAOI2014] 贴海报|普及+

本文涉及知识点 C线段树 [HAOI2014] 贴海报 题目描述 Bytetown 城市要进行市长竞选&#xff0c;所有的选民可以畅所欲言地对竞选市长的候选人发表言论。为了统一管理&#xff0c;城市委员会为选民准备了一个张贴海报的 electoral 墙。 张贴规则如下&#xff1a; electoral…

CSP 2024 提高级第一轮(CSP-S 2024)单选题解析

单选题解析 第 1 题 在 Linux 系统中&#xff0c;如果你想显示当前工作目录的路径&#xff0c;应该使用哪个命令&#xff1f;&#xff08;A&#xff09; A. pwd B. cd C. ls D. echo 解析&#xff1a;Linux 系统中&#xff0c;pwd命令可以显示当前工作目录的路径。pwd&#x…

六、绘制图片

文章目录 1.创建一个红色图片2.加载bmp图片3.加载png、jpg图片 前面的几个示例&#xff0c;我们已经展示过如果在Linux系统下使用xlib接口向窗口中绘制文本、线、矩形&#xff1b;并设置文本、线条的颜色。并利用xlib提供的接口结合事件处理机制完成了一个自绘按钮控件功能。有…

Java 面向对象详解和JVM底层内存分析

先关注、点赞再看、人生灿烂&#xff01;&#xff01;&#xff01;&#xff08;谢谢&#xff09; 神速熟悉面向对象 表格结构和类结构 我们在现实生活中&#xff0c;思考问题、发现问题、处理问题&#xff0c;往往都会用“表格”作为工具。实际上&#xff0c;“表格思维”就是…

深度学习---知识蒸馏(Knowledge Distillation, KD)

一、知识蒸馏的本质与起源 定义&#xff1a; 知识蒸馏是一种模型压缩与迁移技术&#xff0c;通过将复杂高性能的教师模型&#xff08;Teacher Model&#xff09;所学的“知识”迁移到轻量级的学生模型&#xff08;Student Model&#xff09;&#xff0c;使学生模型在参数量和计…

基于CNN卷积神经网络的带频偏QPSK调制信号检测识别算法matlab仿真

目录 1.算法运行效果图预览 2.算法运行软件版本 3.部分核心程序 4.算法理论概述 5.算法完整程序工程 1.算法运行效果图预览 (完整程序运行后无水印) 2.算法运行软件版本 matlab2024b 3.部分核心程序 &#xff08;完整版代码包含详细中文注释和操作步骤视频&#xff09…

【DAY21】 常见的降维算法

内容来自浙大疏锦行python打卡训练营 浙大疏锦行 目录 PCA主成分分析 t-sne降维 线性判别分析 (Linear Discriminant Analysis, LDA) 作业&#xff1a; 什么时候用到降维 降维的主要应用场景 知识点回顾&#xff1a; PCA主成分分析t-sne降维LDA线性判别 通常情况下&#xff0c;…

校园社区小程序源码解析

基于ThinkPHP、FastAdmin和UniApp开发的校园社区小程序源码&#xff0c;旨在为校园内的学生和教职员工提供一个便捷的在线交流和服务平台。 该小程序前端采用UniApp进行开发&#xff0c;具有良好的跨平台兼容性&#xff0c;可以轻松发布到iOS和Android平台。同时&#xff0c;后…

第6章:文件权限

一、文件权限概述 Linux为了保证系统中每个文件的安全&#xff0c;引入了文件权限机制。针对于系统中的每一个文件Linux都可以提供精确的权限控制。它可以做到不同的用户对同一个文件具有不同的操作权利。而通常这个权利包括以下3个&#xff1a; 读的权利&#xff08;Read&…

C语言| 指针变量的定义

C语言| 指针的优点-CSDN博客 * 表示“指向”&#xff0c;为了说明指针变量和它所指向的变量之间的联系。 int * i&#xff1b;//表示指针变量i里面存放的地址&#xff0c;所指向的存储单元里的【数据】。 【指针变量的定义】 C语言规定所有变量&#xff0c;在使用前必须先定…

IntelliJ IDEA给Controller、Service、Mapper不同文件设置不同的文件头注释模板、Velocity模板引擎

通过在 IntelliJ IDEA 中的 “Includes” 部分添加多个文件头模板&#xff0c;并在 “Files” 模板中利用这些包含来实现不同类型文件的注释。以下是为 Controller、Service、Mapper 文件设置不同文件头的完整示例&#xff1a; 1. 设置 Includes 文件头模板 File > Settin…

【论文阅读】BEVFormer

〇、Introduction BEVFormer是现在端到端无人驾驶中常使用的一个Backbone&#xff0c;用于将六个视角下的图像转换为鸟瞰图视角下的特征&#xff0c;转换出的BEV特征则会被用于后续模块的特征交互。然而在这个模型设计的初期&#xff0c;其最本质的意图是为了提取用于各种CV任…