题目:汽车销售信息管理系统 系统功能基本要求: 轿车信息,包括汽车的编号、型号、颜色、生产厂家、出厂日期、价格等;员工信息,包括员工编号、姓名、性别、年龄、藉贯、学历等; 客户信息,包括客户名称、联系方式、地址、业务联系记录等; 汽车销售信息,包括销售日期、汽车类型、颜色、数量、经手人等。按条件查询,并将销售报表打印输出。 用c++程序编写

时间: 2023-09-29 17:10:01 浏览: 31
好的,下面是一个简单的C++程序,用于实现上述汽车销售信息管理系统的基本功能要求: ```c++ #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; // 定义Car类 class Car { private: string id; // 编号 string model; // 型号 string color; // 颜色 string maker; // 生产厂家 string date; // 出厂日期 double price; // 价格 public: Car(string id, string model, string color, string maker, string date, double price) { this->id = id; this->model = model; this->color = color; this->maker = maker; this->date = date; this->price = price; } string getId() { return id; } string getModel() { return model; } string getColor() { return color; } string getMaker() { return maker; } string getDate() { return date; } double getPrice() { return price; } }; // 定义Employee类 class Employee { private: string id; // 员工编号 string name; // 姓名 string gender; // 性别 int age; // 年龄 string hometown;// 籍贯 string education;//学历 public: Employee(string id, string name, string gender, int age, string hometown, string education) { this->id = id; this->name = name; this->gender = gender; this->age = age; this->hometown = hometown; this->education = education; } string getId() { return id; } string getName() { return name; } string getGender() { return gender; } int getAge() { return age; } string getHometown() { return hometown; } string getEducation() { return education; } }; // 定义Customer类 class Customer { private: string name; // 客户名称 string contact; // 联系方式 string address; // 地址 vector<string> records; // 业务联系记录 public: Customer(string name, string contact, string address) { this->name = name; this->contact = contact; this->address = address; } string getName() { return name; } string getContact() { return contact; } string getAddress() { return address; } void addRecord(string record) { records.push_back(record); } vector<string> getRecords() { return records; } }; // 定义Sales类 class Sales { private: string date; // 销售日期 string type; // 汽车类型 string color; // 颜色 int amount; // 数量 string employeeId; // 经手人 public: Sales(string date, string type, string color, int amount, string employeeId) { this->date = date; this->type = type; this->color = color; this->amount = amount; this->employeeId = employeeId; } string getDate() { return date; } string getType() { return type; } string getColor() { return color; } int getAmount() { return amount; } string getEmployeeId() { return employeeId; } }; // 定义一个全局的vector变量,用于存储汽车信息 vector<Car> cars; // 定义一个全局的vector变量,用于存储员工信息 vector<Employee> employees; // 定义一个全局的vector变量,用于存储客户信息 vector<Customer> customers; // 定义一个全局的vector变量,用于存储销售信息 vector<Sales> sales; // 添加汽车信息 void addCar() { string id, model, color, maker, date; double price; cout << "请输入汽车编号:"; cin >> id; cout << "请输入汽车型号:"; cin >> model; cout << "请输入汽车颜色:"; cin >> color; cout << "请输入汽车生产厂家:"; cin >> maker; cout << "请输入汽车出厂日期:"; cin >> date; cout << "请输入汽车价格:"; cin >> price; Car car(id, model, color, maker, date, price); cars.push_back(car); cout << "添加成功!" << endl; } // 添加员工信息 void addEmployee() { string id, name, gender, hometown, education; int age; cout << "请输入员工编号:"; cin >> id; cout << "请输入员工姓名:"; cin >> name; cout << "请输入员工性别:"; cin >> gender; cout << "请输入员工年龄:"; cin >> age; cout << "请输入员工籍贯:"; cin >> hometown; cout << "请输入员工学历:"; cin >> education; Employee employee(id, name, gender, age, hometown, education); employees.push_back(employee); cout << "添加成功!" << endl; } // 添加客户信息 void addCustomer() { string name, contact, address; cout << "请输入客户名称:"; cin >> name; cout << "请输入客户联系方式:"; cin >> contact; cout << "请输入客户地址:"; cin >> address; Customer customer(name, contact, address); customers.push_back(customer); cout << "添加成功!" << endl; } // 添加销售信息 void addSales() { string date, type, color, employeeId; int amount; cout << "请输入销售日期:"; cin >> date; cout << "请输入汽车类型:"; cin >> type; cout << "请输入汽车颜色:"; cin >> color; cout << "请输入销售数量:"; cin >> amount; cout << "请输入经手人编号:"; cin >> employeeId; Sales sale(date, type, color, amount, employeeId); sales.push_back(sale); cout << "添加成功!" << endl; } // 根据编号查询汽车信息 void findCarById() { string id; cout << "请输入汽车编号:"; cin >> id; bool found = false; for (auto car : cars) { if (car.getId() == id) { cout << "编号:" << car.getId() << endl; cout << "型号:" << car.getModel() << endl; cout << "颜色:" << car.getColor() << endl; cout << "生产厂家:" << car.getMaker() << endl; cout << "出厂日期:" << car.getDate() << endl; cout << "价格:" << car.getPrice() << endl; found = true; break; } } if (!found) { cout << "未找到该汽车信息!" << endl; } } // 根据员工姓名查询销售信息 void findSalesByEmployeeName() { string name; cout << "请输入员工姓名:"; cin >> name; bool found = false; for (auto sale : sales) { for (auto employee : employees) { if (sale.getEmployeeId() == employee.getId() && employee.getName() == name) { cout << "销售日期:" << sale.getDate() << endl; cout << "汽车类型:" << sale.getType() << endl; cout << "汽车颜色:" << sale.getColor() << endl; cout << "销售数量:" << sale.getAmount() << endl; cout << "经手人姓名:" << employee.getName() << endl; found = true; break; } } } if (!found) { cout << "未找到该员工的销售信息!" << endl; } } // 输出销售报表 void printSalesReport() { cout << "销售报表:" << endl; cout << "销售日期\t汽车类型\t汽车颜色\t销售数量\t经手人姓名" << endl; for (auto sale : sales) { for (auto employee : employees) { if (sale.getEmployeeId() == employee.getId()) { cout << sale.getDate() << "\t" << sale.getType() << "\t" << sale.getColor() << "\t" << sale.getAmount() << "\t" << employee.getName() << endl; break; } } } } // 主函数 int main() { int choice; while (true) { cout << "请选择操作:" << endl; cout << "1.添加汽车信息" << endl; cout << "2.添加员工信息" << endl; cout << "3.添加客户信息" << endl; cout << "4.添加销售信息" << endl; cout << "5.根据编号查询汽车信息" << endl; cout << "6.根据员工姓名查询销售信息" << endl; cout << "7.输出销售报表" << endl; cout << "8.退出系统" << endl; cin >> choice; switch (choice) { case 1: addCar(); break; case 2: addEmployee(); break; case 3: addCustomer(); break; case 4: addSales(); break; case 5: findCarById(); break; case 6: findSalesByEmployeeName(); break; case 7: printSalesReport(); break; case 8: return 0; default: cout << "无效的操作!" << endl; break; } } return 0; } ``` 上述程序实现了添加汽车、员工、客户和销售信息的功能,并提供了根据编号查询汽车信息、根据员工姓名查询销售信息和输出销售报表的功能。您可以根据需要对程序进行修改和扩展。

相关推荐

最新推荐

recommend-type

WX小程序源码运动健身

WX小程序源码运动健身提取方式是百度网盘分享地址
recommend-type

sja1314.x86_64.tar.gz

SQLyong 各个版本,免费下载 SQLyog是业界著名的Webyog公司出品的一款简洁高效、功能强大的图形化MySQL数据库管理工具。使用SQLyog可以快速直观地让您从世界的任何角落通过网络来维护远端的MySQL数据库。
recommend-type

智能交通辅助 - 基于MATLAB的车牌识别系统设计资源下载

基于MATLAB的车牌识别系统设计资源是一款专业的车牌检测和识别工具包,它利用MATLAB强大的计算和图像处理能力,为用户提供了一套完整的车牌识别解决方案。该系统特别适合智能交通管理系统、停车场自动化以及安全监控等领域。以下是该车牌识别系统的主要特点: 图像预处理:集成图像去噪、灰度化和二值化等预处理功能,提高识别准确性。 车牌定位:采用先进的图像识别算法,快速定位图像中的车牌区域。 字符分割:精确分割车牌中的每个字符,为识别提供清晰的输入。 字符识别:应用机器学习技术,实现对车牌上字符的高准确度识别。 MATLAB兼容:完全基于MATLAB环境开发,易于集成和扩展。 用户界面友好:提供直观的用户界面,便于操作和监控识别过程。 实时处理:支持实时视频流处理,适用于动态交通监控场景。 可定制开发:可根据特定需求进行定制开发,满足不同应用场景。 文档和示例:提供详细的开发文档和示例代码,帮助用户快速理解和应用。 基于MATLAB的车牌识别系统设计资源是智能交通领域开发者的理想选择。立即下载,为您的项目增添强大的车牌识别功能。
recommend-type

debugpy-1.0.0b3-cp34-cp34m-manylinux1_i686.whl

Python库是一组预先编写的代码模块,旨在帮助开发者实现特定的编程任务,无需从零开始编写代码。这些库可以包括各种功能,如数学运算、文件操作、数据分析和网络编程等。Python社区提供了大量的第三方库,如NumPy、Pandas和Requests,极大地丰富了Python的应用领域,从数据科学到Web开发。Python库的丰富性是Python成为最受欢迎的编程语言之一的关键原因之一。这些库不仅为初学者提供了快速入门的途径,而且为经验丰富的开发者提供了强大的工具,以高效率、高质量地完成复杂任务。例如,Matplotlib和Seaborn库在数据可视化领域内非常受欢迎,它们提供了广泛的工具和技术,可以创建高度定制化的图表和图形,帮助数据科学家和分析师在数据探索和结果展示中更有效地传达信息。
recommend-type

c语言华容道源码.zip

c语言华容道源码.zip
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

MATLAB柱状图在信号处理中的应用:可视化信号特征和频谱分析

![matlab画柱状图](https://img-blog.csdnimg.cn/3f32348f1c9c4481a6f5931993732f97.png) # 1. MATLAB柱状图概述** MATLAB柱状图是一种图形化工具,用于可视化数据中不同类别或组的分布情况。它通过绘制垂直条形来表示每个类别或组中的数据值。柱状图在信号处理中广泛用于可视化信号特征和进行频谱分析。 柱状图的优点在于其简单易懂,能够直观地展示数据分布。在信号处理中,柱状图可以帮助工程师识别信号中的模式、趋势和异常情况,从而为信号分析和处理提供有价值的见解。 # 2. 柱状图在信号处理中的应用 柱状图在信号处理
recommend-type

用Spring boot和vue写一个登录注册界面

好的,这是一个比较常见的技术问题,我可以为您提供一些参考资料和思路。首先,您可以使用Spring Boot作为后端框架来处理用户认证和注册的逻辑,比如使用Spring Security实现用户登录认证。同时,您还需要设计相应的数据模型和数据库表结构来存储用户信息。在前端方面,您可以使用Vue.js作为框架来构建登录注册页面,使用Axios来发起API请求并和后端进行交互。当然,在实现过程中,还需要考虑一些具体细节,比如数据校验、安全性和用户体验等方面。希望这些信息能够帮助到您。
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。