#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <fstream>
using namespace std;
// 定义用户信息结构体
struct UserInfo
{
std::string name;
std::string licensePlate;
std::vector< std::string > violations;
};
// 显示用户信息函数
void displayUserInfo(const UserInfo& user)
{
std::cout << "姓名:" << user.name << std::endl;
std::cout << "车牌号:" << user.licensePlate << std::endl;
std::cout << "违章记录:" << std::endl;
for (const std::string& violation : user.violations) {
std::cout << "- " << violation << std::endl;
}
}
// 查询用户信息函数
UserInfo queryUserInfo(const std::string& name)
{
UserInfo user;
user.name = "张三";
user.licensePlate = "京 A12345";
user.violations = { "超速", "闯红灯", "违规停车" };
return user;
}
struct PersonalInfo
{
std::string name;
std::string licensePlate;
std::string year;
int violationCount;
std::vector< std::string > violations;
};
// 查询个人信息函数
void queryPersonalInfo()
{
PersonalInfo info;
info.name = "张三";
info.year="20";
info.licensePlate = "京 A12345";
info.violationCount = 3;
std::cout << "姓名:" << info.name << std::endl;
std::cout << "年龄:" <<info .year << std::endl;
std::cout << "车牌号:" << info.licensePlate << std::endl;
std::cout << "违章次数:" << info.violationCount << std::endl;
cout<<"超速"<<endl;
cout<<"闯红灯"<<endl;
cout<<"违规停车"<<endl;
}
// 违章信息类
class TrafficViolation
{
public:
std::string vehicleLicense; // 车辆牌照
std::string violationType; // 违章类型
std::string violationTime; // 违章时间
};
// 交通违章管理系统类
class TrafficViolationManagementSystem
{
private:
std::map<std::string, TrafficViolation> violations; // 保存违章信息的映射
public:
// 添加违章信息
void addViolation(const std::string& license, const std::string& typ