Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <map>
- #include <iostream>
- #include <fstream>
- #include <utility>
- #include <vector>
- #include <algorithm> // std::random_shuffle
- #include <ctime> // std::time
- #include <cstdlib> // std::rand, std::srand
- #include <random>
- using namespace std;
- struct Task {
- Task(string url, string type) {
- this->url = std::move(url);
- this->type = std::move(type);
- }
- string url;
- string type;
- };
- struct BinLearn {
- BinLearn(string url, string signRus, string res, string hint) {
- this->url = std::move(url);
- this->signRus = std::move(signRus);
- this->hint = std::move(hint);
- this->res = std::move(res);
- }
- string url;
- string signRus;
- string res;
- string hint;
- };
- int main() {
- srand(time(nullptr));
- freopen("Road_Signs/Экзамен-Table 1.tsv", "r", stdin); // Боевые задания-Table 1.tsv Боевые задания
- freopen("TASKShw5ExamBin.tsv", "w", stdout);
- string url, type;
- vector<Task> data;
- cout << "INPUT:image\tINPUT:sign_name\tGOLDEN:result\n"; // HINT:text
- while (cin >> url >> type) {
- // cout << url << '\t' << type << endl;
- data.emplace_back(url, type);
- }
- vector<BinLearn> dataBin;
- vector<string> curSign;
- vector<string> curSignRus;
- curSign.emplace_back("no_stop");
- curSign.emplace_back("give_way");
- curSign.emplace_back("bus_stop");
- curSign.emplace_back("pedestrian");
- curSign.emplace_back("main_road");
- curSignRus.emplace_back("Остановка запрещена");
- curSignRus.emplace_back("Уступи дорогу");
- curSignRus.emplace_back("Остановка общественного транспорта");
- curSignRus.emplace_back("Пешеходный переход");
- curSignRus.emplace_back("Главная дорога");
- std::random_device rd;
- std::mt19937 g(rd());
- std::shuffle(begin(data), end(data), g);
- string typeRus;
- for (size_t i = 0; i < data.size(); ++i) {
- for (size_t j = 0; j < 5; ++j) {
- string hint = "Выделенный дорожный знак - \"";
- if (data[i].type == "no_stop") {
- typeRus = "Остановка запрещена";
- } else if (data[i].type == "give_way") {
- typeRus = "Уступи дорогу";
- } else if (data[i].type == "bus_stop") {
- typeRus = "Остановка общественного транспорта";
- } else if (data[i].type == "pedestrian") {
- typeRus = "Пешеходный переход";
- } else {
- typeRus = "Главная дорога";
- }
- hint += typeRus;
- hint += "\"";
- string res = "false";
- if (data[i].type == curSign[j]) {
- res = "true";
- }
- dataBin.emplace_back(data[i].url, curSignRus[j], res, hint);
- // cout << data[i].url << '\t' << curSignRus[j] << '\t' << res << '\t' << hint << endl;
- }
- }
- std::shuffle(begin(dataBin), end(dataBin), g);
- for (size_t i = 0; i < 35; ++i) {
- cout << dataBin[i].url << '\t' << dataBin[i].signRus << '\t' << dataBin[i].res << endl;
- }
- // ifstream tlkin;
- // tlkin.open("Road_Signs/Боевые задания-Table 1.tsv");
- // while (tlkin >> url >> type) {
- // for (size_t j = 0; j < 5; ++j) {
- // cout << url << '\t' << curSignRus[j] << '\t' << endl;
- // }
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement