c++程序实验课程交通处罚管理系统
需要有车牌,处罚人姓名,交警名字,编号处罚单号,可以查询和查找,可以正常运行,有帮助的吗,有偿
#include<iostream> #include <string> #include <vector> using namespace std; struct faDan { string ID; //罚单ID string carID; //车牌号 string userName; //车主名字 string policyName; //交警名字 }; void menu(); void select(); void deletes(); void insert(); vector<faDan> v; int main() { int n = 0; while (1) { menu(); cin >> n; switch (n) { case 0: break; case 1: select(); break; case 2: deletes(); break; case 3: insert(); break; } } } void select() { cout << "请输入“罚单ID:" << endl; string ID; cin >> ID; //仅实现条件为罚单ID的查询功能,若需其它自己扩展 for (auto it = v.begin(); it != v.end(); it++) { if (it->ID == ID) { cout << "查询结果" << endl; cout << it->ID << " " << it->carID << " " << it->userName << " " << it->policyName << " " << endl << endl; } else { cout << "NULL" << endl; } } } void deletes() { cout << "请输入“罚单ID:" << endl; string ID; cin >> ID; //仅实现条件为罚单ID的删除功能,若需其它自己扩展 for (auto it = v.begin(); it != v.end(); ) { if (it->ID == ID) { it = v.erase(it); } else it++; } } void insert() { cout << "请输入“罚单ID”,“车牌号”,“车主名”,“交警名”以空格间隔:" << endl; faDan d; cin >> d.ID >> d.carID >> d.userName >> d.policyName; v.push_back(d); cout << "添加OK" << endl << endl; } void menu() { cout << "罚钱系统功能列表:" << endl; cout << "请选择:1.查询,2..删除,3.添加" << endl; }