用c语言写一个笔记本电脑销售系统

主要功能:
1、实现主菜单的操作界面。
2、财务管理
3、销售管理
4、查询各电脑型号价格
5、查询供应商联系方式
6、查询电脑型号具体配置
7、统计业务员业绩、统计各类笔记本电脑销售情况
8、输入笔记本电脑销售情况(各型号销售数量)

https://blog.csdn.net/qq_29053423/article/details/109016028?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522167714155216800184170961%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=167714155216800184170961&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~rank_v31_ecpm-1-109016028-null-null.blog_rank_default&utm_term=%E7%94%A8c%E8%AF%AD%E8%A8%80%E5%86%99%E4%B8%80%E4%B8%AA%E7%AC%94%E8%AE%B0%E6%9C%AC%E7%94%B5%E8%84%91%E9%94%80%E5%94%AE%E7%B3%BB%E7%BB%9F&spm=1018.2226.3001.4450

该回答引用chatgpt ,为你提供基本框架:

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

struct Laptop {
    int id; // 笔记本电脑型号
    char brand[20]; // 笔记本电脑品牌
    char model[20]; // 笔记本电脑型号名称
    int price; // 笔记本电脑价格
    char configuration[50]; // 笔记本电脑配置信息
};

struct Sales {
    int id; // 笔记本电脑型号
    int quantity; // 销售数量
};

struct Supplier {
    char name[20]; // 供应商名称
    char phone[20]; // 供应商联系方式
};

void main_menu();
void finance_menu();
void sales_menu();
void query_price();
void query_supplier();
void query_configuration();
void sales_statistics();
void sales_input();

int main() {
    main_menu();
    return 0;
}

void main_menu() {
    int choice;
    do {
        printf("欢迎使用笔记本电脑销售系统\n");
        printf("1. 财务管理\n");
        printf("2. 销售管理\n");
        printf("3. 查询各电脑型号价格\n");
        printf("4. 查询供应商联系方式\n");
        printf("5. 查询电脑型号具体配置\n");
        printf("6. 统计业务员业绩、统计各类笔记本电脑销售情况\n");
        printf("7. 输入笔记本电脑销售情况(各型号销售数量)\n");
        printf("0. 退出\n");
        printf("请选择操作:");
        scanf("%d", &choice);

        switch (choice) {
            case 1:
                finance_menu();
                break;
            case 2:
                sales_menu();
                break;
            case 3:
                query_price();
                break;
            case 4:
                query_supplier();
                break;
            case 5:
                query_configuration();
                break;
            case 6:
                sales_statistics();
                break;
            case 7:
                sales_input();
                break;
            case 0:
                printf("感谢使用笔记本电脑销售系统,再见!\n");
                break;
            default:
                printf("无效操作,请重新选择!\n");
                break;
        }
    } while (choice != 0);
}

void finance_menu() {
    // 实现财务管理功能
}

void sales_menu() {
    // 实现销售管理功能
}

void query_price() {
    // 查询各电脑型号价格
}

void query_supplier() {
    // 查询供应商联系方式
}

void query_configuration() {
    // 查询电脑型号具体配置
}

void sales_statistics() {
    // 统计业务员业绩、统计各类笔记本电脑销售情


该回答引用ChatGPT

1、实现主菜单的操作界面。

#include <stdio.h>

// 定义电脑结构体
struct Laptop {
    char brand[20];
    char model[20];
    int price;
};

// 定义一个全局的电脑数组,最多存储 100 台电脑
struct Laptop laptops[100];

// 定义电脑数量
int laptop_count = 0;

// 打印主菜单
void print_main_menu() {
    printf("欢迎使用笔记本电脑销售系统\n");
    printf("1. 查看所有电脑\n");
    printf("2. 添加电脑\n");
    printf("3. 修改电脑\n");
    printf("4. 删除电脑\n");
    printf("5. 退出系统\n");
    printf("请选择操作:");
}

// 查看所有电脑
void view_laptops() {
    printf("所有电脑信息如下:\n");
    for (int i = 0; i < laptop_count; i++) {
        printf("品牌:%s,型号:%s,价格:%d\n", laptops[i].brand, laptops[i].model, laptops[i].price);
    }
}

// 添加电脑
void add_laptop() {
    struct Laptop laptop;
    printf("请输入电脑品牌:");
    scanf("%s", laptop.brand);
    printf("请输入电脑型号:");
    scanf("%s", laptop.model);
    printf("请输入电脑价格:");
    scanf("%d", &laptop.price);
    laptops[laptop_count] = laptop;
    laptop_count++;
    printf("添加成功!\n");
}

// 修改电脑
void update_laptop() {
    int index;
    printf("请输入要修改的电脑编号:");
    scanf("%d", &index);
    if (index < 1 || index > laptop_count) {
        printf("无效的编号!\n");
    } else {
        struct Laptop laptop;
        printf("请输入电脑品牌:");
        scanf("%s", laptop.brand);
        printf("请输入电脑型号:");
        scanf("%s", laptop.model);
        printf("请输入电脑价格:");
        scanf("%d", &laptop.price);
        laptops[index-1] = laptop;
        printf("修改成功!\n");
    }
}

// 删除电脑
void delete_laptop() {
    int index;
    printf("请输入要删除的电脑编号:");
    scanf("%d", &index);
    if (index < 1 || index > laptop_count) {
        printf("无效的编号!\n");
    } else {
        for (int i = index-1; i < laptop_count-1; i++) {
            laptops[i] = laptops[i+1];
        }
        laptop_count--;
        printf("删除成功!\n");
    }
}

int main() {
    int choice;
    do {
        print_main_menu();
            scanf("%d", &choice);
    switch (choice) {
        case 1:
            view_laptops();
            break;
        case 2:
            add_laptop();
            break;
        case 3:
            update_laptop();
            break;
        case 4:
            delete_laptop();
            break;
        case 5:
            printf("谢谢使用笔记本电脑销售系统,再见!\n");
            break;
        default:
            printf("无效的操作!\n");
            break;
    }
} while (choice != 5);
return 0;


2、财务管理

#include <stdio.h>

// 定义电脑结构体
struct Laptop {
    char brand[20];
    char model[20];
    int price;
    int quantity; // 新增属性:数量
};

// 定义一个全局的电脑数组,最多存储 100 台电脑
struct Laptop laptops[100];

// 定义电脑数量
int laptop_count = 0;

// 新增函数:计算总销售额
int calculate_total_sales() {
    int total_sales = 0;
    for (int i = 0; i < laptop_count; i++) {
        total_sales += laptops[i].price * laptops[i].quantity;
    }
    return total_sales;
}

// 新增函数:计算总成本
int calculate_total_cost() {
    int total_cost = 0;
    for (int i = 0; i < laptop_count; i++) {
        total_cost += 5000 * laptops[i].quantity; // 假设每台电脑成本为 5000 元
    }
    return total_cost;
}

// 新增函数:计算总利润
int calculate_total_profit() {
    int total_profit = calculate_total_sales() - calculate_total_cost();
    return total_profit;
}

// 新增函数:打印财务报表
void print_financial_report() {
    printf("笔记本电脑销售系统财务报表\n");
    printf("总销售额:%d 元\n", calculate_total_sales());
    printf("总成本:%d 元\n", calculate_total_cost());
    printf("总利润:%d 元\n", calculate_total_profit());
}

// 打印主菜单
void print_main_menu() {
    printf("欢迎使用笔记本电脑销售系统\n");
    printf("1. 查看所有电脑\n");
    printf("2. 添加电脑\n");
    printf("3. 修改电脑\n");
    printf("4. 删除电脑\n");
    printf("5. 查看财务报表\n");
    printf("6. 退出系统\n");
    printf("请选择操作:");
}

// 查看所有电脑
void view_laptops() {
    printf("所有电脑信息如下:\n");
    for (int i = 0; i < laptop_count; i++) {
        printf("品牌:%s,型号:%s,价格:%d,数量:%d\n", laptops[i].brand, laptops[i].model, laptops[i].price, laptops[i].quantity);
    }
}


// 添加电脑
void add_laptop() {
    struct Laptop laptop;
    printf("请输入电脑品牌:");
    scanf("%s", laptop.brand);
    printf("请输入电脑型号:");
    scanf("%s", laptop.model);
    printf("请输入电脑价格:");
    scanf("%d", &laptop.price);
    printf("请输入电脑数量:");
    scanf("%d", &laptop.quantity);
    laptops[laptop_count] = laptop;
    laptop_count++;
    printf("添加成功!\n");
}



3、销售管理

#include <stdio.h>

// 定义电脑结构体
struct Laptop {
    char brand[20];
    char model[20];
    int price;
    int quantity; // 新增属性:数量
};

// 定义销售记录结构体
struct Sale {
    char customer_name[20];
    int laptop_index;
    int quantity;
    int price;
    int year;
    int month;
    int day;
};

// 定义一个全局的电脑数组,最多存储 100 台电脑
struct Laptop laptops[100];

// 定义电脑数量
int laptop_count = 0;

// 定义一个全局的销售记录数组,最多存储 100 条记录
struct Sale sales[100];

// 定义销售记录数量
int sale_count = 0;

// 新增函数:计算总销售额
int calculate_total_sales() {
    int total_sales = 0;
    for (int i = 0; i < sale_count; i++) {
        total_sales += sales[i].price * sales[i].quantity;
    }
    return total_sales;
}

// 新增函数:计算总成本
int calculate_total_cost() {
    int total_cost = 0;
    for (int i = 0; i < sale_count; i++) {
        int laptop_index = sales[i].laptop_index;
        int cost_per_unit = 5000; // 假设每台电脑成本为 5000 元
        int quantity = sales[i].quantity;
        int cost = cost_per_unit * quantity;
        total_cost += cost;
    }
    return total_cost;
}

// 新增函数:计算总利润
int calculate_total_profit() {
    int total_profit = calculate_total_sales() - calculate_total_cost();
    return total_profit;
}

// 新增函数:打印财务报表
void print_financial_report() {
    printf("笔记本电脑销售系统财务报表\n");
    printf("总销售额:%d 元\n", calculate_total_sales());
    printf("总成本:%d 元\n", calculate_total_cost());
    printf("总利润:%d 元\n", calculate_total_profit());
}

// 打印主菜单
void print_main_menu() {
    printf("欢迎使用笔记本电脑销售系统\n");
    printf("1. 查看所有电脑\n");
    printf("2. 添加电脑\n");
    printf("3. 修改电脑\n");
    printf("4. 删除电脑\n");
    printf("5. 查看财务报表\n");
    printf("6. 查看销售记录\n");
    printf("7. 添加销售记录\n");
    printf("8. 修改销售记录\n");
    printf("9. 删除销售记录\n");
    printf("10. 退出系统\n");
    printf("请选择操作:");
}

// 查看所有电脑
void view_laptops() {
    printf("所有电脑信息如下:\n");
    for (int i = 0; i < laptop_count; i++) {
        printf("编号:%d,品牌:%s,型号:%s,价格:%d,数量:%d\n", i+1, laptops[i].brand, laptops[i].model, laptops[i].price, laptops[i].quantity);
    }
}

// 添加电脑
void add_laptop() {
    struct Laptop laptop;
    printf("请输入电脑品牌:");
    scanf("%s", laptop.brand);
    printf("请输入电脑型号:");
    scanf("%s", laptop.model);
    printf("请输入电脑价格:");
    scanf("%d", &laptop.price);
    printf("请输入电脑数量:");
    scanf("%d", &laptop.quantity);
    laptops[laptop_count] = laptop;
    laptop_count++;
    printf("添加成功!\n");
}

// 修改电脑
void update_laptop() {
    int index;
    printf("请输入要修改的电脑编号:");
    scanf("%d", &index);
    if (index < 1 || index > laptop_count) {
        printf("无效的编号!\n");
    } else {
        struct Laptop laptop;
        printf("请输入电脑品牌:");
        scanf("%s", laptop.brand);
        printf("请输入电脑型号:");
        scanf("%s", laptop.model);
        printf("请输入电脑价格:");
        scanf("%d", &laptop.price);
        printf("请输入电脑数量:");
        scanf("%d", &laptop.quantity);
        laptops[index-1] = laptop;
        printf("修改成功!\n");
    }
}

// 删除电脑
void delete_laptop() {
    int index;
    printf("请输入要删除的电脑编号:");
    scanf("%d", &index);
    if (index < 1 || index > laptop_count) {
        printf("无效的编号!\n");
    } else {
        for (int i = index-1; i < laptop_count-1; i++) {
            laptops[i] = laptops[i+1];
        }
        laptop_count--;
        printf("删除成功!\n");
    }
}

// 查看销售记录
void view_sales() {
    printf("所有销售记录如下:\n");
    for (int i = 0; i < sale_count; i++) {
        printf("编号:%d,客户:%s,品牌:%s,型号:%s,价格:%d,数量:%d,日期:%04d-%02d-%02d\n", i+1, sales[i].customer_name, laptops[sales[i].laptop_index].brand, laptops[sales[i].laptop_index].model, sales[i].price, sales[i].quantity, sales[i].year, sales[i].month, sales[i].day);
    }
}

// 添加销售记录
void add_sale() {
    int laptop_index;
    printf("请输入售出电脑的编号:");
    scanf("%d", &laptop_index);
    if (laptop_index < 1 || laptop_index > laptop_count) {
        printf("无效的电脑编号!\n");
        return;
    }
    if (laptops[laptop_index-1].quantity <= 0) {
        printf("该电脑库存不足!\n");
        return;
    }
    struct Sale sale;
    printf("请输入客户姓名:");
    scanf("%s", sale.customer_name);
    sale.laptop_index = laptop_index - 1;
    printf("请输入销售数量:");
    scanf("%d", &sale.quantity);
    if (sale.quantity > laptops[sale.laptop_index].quantity) {
        printf("销售数量不能大于库存数量!\n");
        return;
    }
    sale.price = laptops[sale.laptop_index].price;
    printf("请输入销售日期(年-月-日):");
    scanf("%d-%d-%d", &sale.year, &sale.month, &sale.day);
    laptops[sale.laptop_index].quantity -= sale.quantity;
    sales[sale_count] = sale;
    sale_count++;
    printf("添加成功!\n");
}

// 修改销售记录
void update_sale() {
    int index;
    printf("请输入要修改的销售记录编号:");
    scanf("%d", &index);
    if (index < 1 || index > sale_count) {
        printf("无效的编号!\n");
    } else {
        struct Sale sale;
        printf("请输入客户姓名:");
        scanf("%s", sale.customer_name);
        int laptop_index;
        printf("请输入售出电脑的编号:");
        scanf("%d", &laptop_index);
        if (laptop_index < 1 || laptop_index > laptop_count) {
            printf("无效的电脑编号!\n");
            return;
        }
        if (laptops[laptop_index-1].quantity <= 0) {
            printf("该电脑库存不足!\n");
            return;
        }
        sale.laptop_index = laptop_index - 1;
        printf("请输入销售数量:");
        scanf("%d", &sale.quantity);
        if (sale.quantity > laptops[sale.laptop_index].quantity) {
            printf("销售数量不能大于库存数量!\n");
            return;
        }
        sale.price = laptops[sale.laptop_index].price;
        printf("请输入销售日期(年-月-日):");
        scanf("%d-%d-%d", &sale.year, &sale.month, &sale.day);
        laptops[sale.laptop_index].quantity += sales[index-1].quantity;
        laptops[sale.laptop_index].quantity -= sale.quantity;
        sales[index-1] = sale;
        printf("修改成功!\n");
    }
}

// 删除销售记录
void delete_sale() {
    int index;
    printf("请输入要删除的销售记录编号:");
    scanf("%d", &index);
    if (index < 1 || index > sale_count) {
        printf("无效的编号!\n");
    } else {
        laptops[sales[index-1].laptop_index].quantity += sales[index-1].quantity;
        for (int i = index-1; i < sale_count-1; i++) {
            sales[i] = sales[i+1];
        }
        sale_count--;
        printf("删除成功!\n");
    }
} 

int main() {
    int choice;
    do {
        print_main_menu();
        scanf("%d", &choice);
        switch (choice) {
            case 1:
                view_laptops();
                break;
            case 2:
                add_laptop();
                break;
            case 3:
                update_laptop();
                break;
            case 4:
                delete_laptop();
                break;
            case 5:
                print_financial_report();
                break;
            case 6:
                view_sales();
                break;
            case 7:
                add_sale();
                break;
            case 8:
                update_sale();
                break;
            case 9:
                delete_sale();
                break;
            case 10:
                printf("谢谢使用笔记本电脑销售系统,再见!\n");
                break;
            default:
                printf("无效的操作!\n");
                break;
        }
    } while (choice != 10);
    return 0;
} 

C语言笔记本电脑销售系统课设
借鉴下
https://blog.csdn.net/qq_29053423/article/details/109016028

参考GPT和自己的思路,以下是一个简单的C语言笔记本电脑销售系统的框架,包含主菜单及各个功能模块的基本函数定义:

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

// 定义电脑型号的结构体
typedef struct {
    char model[20];    // 型号名称
    int price;         // 价格
    char config[50];   // 配置信息
    char supplier[20]; // 供应商联系方式
} Laptop;

// 函数声明
void displayMenu();                // 显示主菜单
void financeManagement();          // 财务管理
void salesManagement();            // 销售管理
void queryPrice();                 // 查询电脑型号价格
void querySupplierContactInfo();   // 查询供应商联系方式
void queryConfig();                // 查询电脑型号具体配置
void salesStatistics();            // 统计业务员业绩、统计各类笔记本电脑销售情况
void inputSalesRecord();           // 输入笔记本电脑销售情况(各型号销售数量)

int main() {
    int choice;
    while (1) {
        displayMenu();
        printf("请选择功能:");
        scanf("%d", &choice);
        switch (choice) {
            case 1:
                financeManagement();
                break;
            case 2:
                salesManagement();
                break;
            case 3:
                queryPrice();
                break;
            case 4:
                querySupplierContactInfo();
                break;
            case 5:
                queryConfig();
                break;
            case 6:
                salesStatistics();
                break;
            case 7:
                inputSalesRecord();
                break;
            case 0:
                printf("谢谢使用,再见!\n");
                exit(0);
            default:
                printf("无效的选择,请重新输入!\n");
        }
    }
    return 0;
}

// 显示主菜单
void displayMenu() {
    printf("===============\n");
    printf(" 1. 财务管理\n");
    printf(" 2. 销售管理\n");
    printf(" 3. 查询电脑型号价格\n");
    printf(" 4. 查询供应商联系方式\n");
    printf(" 5. 查询电脑型号具体配置\n");
    printf(" 6. 统计业务员业绩、统计各类笔记本电脑销售情况\n");
    printf(" 7. 输入笔记本电脑销售情况\n");
    printf(" 0. 退出系统\n");
    printf("===============\n");
}

// 财务管理
void financeManagement() {
    // TODO
}

// 销售管理
void salesManagement() {
    // TODO
}

// 查询电脑型号价格
void queryPrice() {
    // TODO
}

// 查询供应商联系方式
void querySupplierContactInfo() {
    // TODO
}

// 查询电脑型号具体配置
void queryConfig() {
    // TODO
}

// 统计业务员业绩、统计各类笔记本电脑销售情况
void sales()
{
int choice;
do
{
    printf("\n\n\t\t\t1. 统计业务员业绩\n");
    printf("\t\t\t2. 统计各类笔记本电脑销售情况\n");
    printf("\t\t\t3. 返回主菜单\n");
    printf("\t\t\t请输入选项(1-3): ");

    scanf("%d", &choice);

    switch (choice)
    {
        case 1:
            // 统计业务员业绩代码
            break;
        case 2:
            // 统计各类笔记本电脑销售情况代码
            break;
        case 3:
            printf("\n\n\t\t\t返回主菜单\n");
            break;
        default:
            printf("\n\n\t\t\t无效选项,请重新输入\n");
    }
} while (choice != 3);
}

如果对您有帮助,请给与采纳,谢谢。

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

// 笔记本电脑结构体
struct Laptop {
    char model[20];     // 型号
    char cpu[20];       // CPU
    int memory;         // 内存大小(GB)
    int storage;        // 存储容量(GB)
    float price;        // 价格
};

// 供应商结构体
struct Supplier {
    char name[20];      // 名称
    char phone[20];     // 联系电话
    char email[20];     // 电子邮件
};

// 销售情况结构体
struct SalesRecord {
    char salesman[20];  // 业务员姓名
    char model[20];     // 型号
    int quantity;       // 销售数量
};

// 笔记本电脑数组
struct Laptop laptops[] = {
    {"ThinkPad X1 Carbon", "Intel Core i7-1185G7", 16, 1, 9999.0},
    {"MacBook Air", "Apple M1", 8, 256, 8999.0},
    {"Dell XPS 13", "Intel Core i5-1135G7", 8, 256, 7999.0},
    {"HP Spectre x360", "Intel Core i7-1165G7", 16, 512, 8999.0},
};

// 供应商数组
struct Supplier suppliers[] = {
    {"Lenovo", "400-813-6161", "lenovo@lenovo.com"},
    {"Apple", "400-666-8800", "apple@apple.com"},
    {"Dell", "400-882-9999", "dell@dell.com"},
    {"HP", "400-820-0900", "hp@hp.com"},
};

// 销售情况数组
struct SalesRecord sales_records[100];
int num_sales_records = 0;

// 显示主菜单
void show_menu() {
    printf("=====================\n");
    printf("笔记本电脑销售系统\n");
    printf("=====================\n");
    printf("1. 财务管理\n");
    printf("2. 销售管理\n");
    printf("3. 查询各电脑型号价格\n");
    printf("4. 查询供应商联系方式\n");
    printf("5. 查询电脑型号具体配置\n");
    printf("6. 统计业务员业绩\n");
    printf("7. 统计各类笔记本电脑销售情况\n");
    printf("8. 输入笔记本电脑销售情况\n");
    printf("0. 退出\n");
    printf("=====================\n");
}

// 显示财务管理菜单
void show_finance_menu() {
    printf("=====================\n");
    printf("财务管理\n");
    printf("=====================\n");
    // TODO: 实现财务管理功能
    printf("敬请期待...\n");
}

该回答引用ChatGPT
这是一个比较大的项目,需要分多个模块来完成,以下是一个可能的实现方案:

  1. 实现主菜单的操作界面
    可以使用基本的控制台输入输出来实现,利用switch-case结构实现主菜单的各个选项,例如:
int main() {
    int choice;
    do {
        printf("==============Welcome to the Notebook Sales System==============\n");
        printf("1. Financial Management\n");
        printf("2. Sales Management\n");
        printf("3. Query Notebook Prices\n");
        printf("4. Query Supplier Contact Information\n");
        printf("5. Query Notebook Specifications\n");
        printf("6. Sales Statistics\n");
        printf("7. Enter Sales Information\n");
        printf("0. Exit\n");
        printf("Please enter your choice: ");
        scanf("%d", &choice);
        switch(choice) {
            case 1:
                // 进入财务管理模块
                break;
            case 2:
                // 进入销售管理模块
                break;
            case 3:
                // 进入查询电脑价格模块
                break;
            case 4:
                // 进入查询供应商联系方式模块
                break;
            case 5:
                // 进入查询电脑型号具体配置模块
                break;
            case 6:
                // 进入统计业务员业绩、统计各类笔记本电脑销售情况模块
                break;
            case 7:
                // 进入输入笔记本电脑销售情况模块
                break;
            case 0:
                printf("Thank you for using the Notebook Sales System.\n");
                break;
            default:
                printf("Invalid choice. Please try again.\n");
                break;
        }
    } while (choice != 0);
    return 0;
}


  1. 实现财务管理
    财务管理包括进货、销售、库存等各个方面的管理,可以定义一个结构体来表示每个笔记本电脑的信息,例如:

typedef struct {
    int id; // 型号编号
    char name[20]; // 型号名称
    int price; // 售价
    int cost; // 成本
    int stock; // 库存
} Notebook;

可以使用文件读写操作来实现数据的存储和管理,例如:

void addNotebook(Notebook n) {
    FILE *fp;
    fp = fopen("notebooks.dat", "ab");
    if (fp == NULL) {
        printf("Failed to open file.\n");
        return;
    }
    fwrite(&n, sizeof(Notebook), 1, fp);
    fclose(fp);
}

void displayNotebooks() {
    FILE *fp;
    Notebook n;
    fp = fopen("notebooks.dat", "rb");
    if (fp == NULL) {
        printf("Failed to open file.\n");
        return;
    }
    printf("%-5s %-20s %-10s %-10s %-10s\n", "ID", "Name", "Price", "Cost", "Stock");
    while (fread(&n, sizeof(Notebook), 1, fp) == 1) {


以下答案基于ChatGPT与GISer Liu编写:

代码太多,给你方案:

  1. 首先需要设计一个合适的数据结构来存储笔记本电脑的信息,包括型号、配置、价格等,以及业务员、供应商等其他信息。
  2. 实现主菜单界面,可以使用命令行界面或者GUI界面,让用户可以方便地进行各种操作。
  3. 财务管理包括对进货、销售、成本等方面的管理,需要设计合适的数据结构来存储这些信息,并实现相应的计算和统计功能。
  4. 销售管理需要实现对笔记本电脑销售情况的记录和查询,包括销售员、销售时间、销售数量、销售价格等信息。
  5. 查询各电脑型号价格需要从数据结构中获取相应的信息,并以合适的格式显示给用户。
  6. 查询供应商联系方式也需要从数据结构中获取相应的信息,并以合适的格式显示给用户。
  7. 统计业务员业绩和笔记本电脑销售情况需要实现相应的计算和统计功能,包括对销售量、销售额、成本、利润等方面的统计。
  8. 输入笔记本电脑销售情况需要实现一个相应的界面,让用户输入销售员、销售时间、销售数量、销售价格等信息,并将这些信息保存到数据结构中。

除了上述建议,你还可以考虑使用文件或者数据库来存储数据,以便在程序关闭后仍然能够保存数据。同时,在编写代码时,要注意良好的代码风格和注释,以方便日后的维护和扩展。


不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^