Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "platenumb.h"
- #include "./ui_platenumb.h"
- #include <unordered_set>
- PlateNumb::PlateNumb(QWidget *parent)
- : QMainWindow(parent)
- , ui(new Ui::PlateNumb)
- {
- ui->setupUi(this);
- ui->GenPlateBT1->setVisible(false);
- }
- PlateNumb::~PlateNumb()
- {
- delete ui;
- }
- std::unordered_set <QString> setPlate;
- QString genPlate ="";
- void PlateNumb::on_GenPlateBT1_clicked()
- {
- QString albet;
- char al2;
- genPlate="";
- for (int ch = 'A'; ch <= 'Z'; ch++) {
- al2=(char)ch;
- albet+=al2;
- }
- for (int i=0;i<4;i++){
- int randTemp = rand() % albet.length();
- genPlate.append(albet[randTemp]);
- }
- genPlate.append("-") ;
- for (int i=0;i<3;i++){
- int randTemp = rand() % 10;
- genPlate.append(QString::number(randTemp));
- }
- setPlate.insert(genPlate);
- }
- void PlateNumb::on_GenLotBT2_clicked()
- {
- for (int i =0; i<100;i++){
- PlateNumb::on_GenPlateBT1_clicked();
- }
- for (auto i = setPlate.begin();i!=setPlate.end();i++)
- {
- ui->GennedPlateListLE1->append(*i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement