Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // keeptalking.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <conio.h>
- #include <iostream>
- #include <map>
- #include <string>
- #include <vector>
- using namespace std;
- void Numbers() {
- map<int, pair<int, int>> m;
- int input, pos, digit;
- auto read = [&] {
- int ret = _getch() - '0';
- system("cls");
- return ret;
- };
- auto record = [&](int stage) { m.emplace(stage, make_pair(pos, digit)); };
- input = read();
- switch (input) {
- case 3: {
- pos = 3;
- cout << pos << "-я" << endl;
- } break;
- case 4: {
- pos = 4;
- cout << pos << "-я" << endl;
- } break;
- default: {
- pos = 2;
- cout << pos << "-я" << endl;
- } break;
- }
- digit = read();
- record(1);
- input = read();
- switch (input) {
- case 1: {
- digit = 4;
- cout << "\"" << digit << "\"" << endl;
- pos = read();
- } break;
- case 3: {
- pos = 1;
- cout << pos << "-я" << endl;
- digit = read();
- } break;
- default: {
- pos = m.at(1).first;
- cout << pos << "-я" << endl;
- digit = read();
- } break;
- }
- record(2);
- input = read();
- switch (input) {
- case 1: {
- digit = m.at(2).second;
- cout << "\"" << digit << "\"" << endl;
- pos = read();
- } break;
- case 2: {
- digit = m.at(1).second;
- cout << "\"" << digit << "\"" << endl;
- pos = read();
- } break;
- case 3: {
- pos = 3;
- cout << pos << "-я" << endl;
- digit = read();
- } break;
- case 4: {
- digit = 4;
- cout << "\"" << digit << "\"" << endl;
- pos = read();
- } break;
- }
- record(3);
- input = read();
- switch (input) {
- case 1: {
- pos = m.at(1).first;
- cout << pos << endl;
- digit = read();
- } break;
- case 2: {
- pos = 1;
- cout << pos << "-я" << endl;
- digit = read();
- } break;
- default: {
- pos = m.at(2).first;
- cout << pos << endl;
- digit = read();
- } break;
- }
- record(4);
- input = read();
- switch (input) {
- case 1: {
- digit = m.at(1).second;
- cout << "\"" << digit << "\"" << endl;
- } break;
- case 2: {
- digit = m.at(2).second;
- cout << "\"" << digit << "\"" << endl;
- } break;
- case 3: {
- digit = m.at(4).second;
- cout << "\"" << digit << "\"" << endl;
- } break;
- case 4: {
- digit = m.at(3).second;
- cout << "\"" << digit << "\"" << endl;
- } break;
- }
- m.clear();
- _getch();
- system("cls");
- return;
- }
- void WireSequences() {
- vector<vector<string>> v = { { "c", "b", "abc" },{ "b", "ac", "ac" },{ "a", "b", "b" },{ "ac", "a", "ac" },{ "b", "b", "b" },{ "ac", "bc", "bc" },{ "abc", "c", "ab" },{ "ab", "ac", "c" },{ "b", "a", "c" } };
- int redCount = 0, blueCount = 0, blackCount = 0;
- auto resetCount = [&] {redCount = 0; blueCount = 0; blackCount = 0; };
- char input;
- do {
- system("cls");
- if (redCount > 8 || blueCount > 8 || blackCount > 8)
- resetCount();
- cout << v.at(redCount).at(0) << " ";
- cout << v.at(blueCount).at(1) << " ";
- cout << v.at(blackCount).at(2) << endl;
- input = _getch();
- switch (input) {
- case 'q': redCount++; break;
- case 'w': blueCount++; break;
- case 'e': blackCount++; break;
- case 'r': resetCount(); break;
- case 'a': {
- resetCount();
- system("cls");
- Numbers();
- } break;
- }
- } while (true);
- }
- int main()
- {
- system("@chcp 1251");
- WireSequences();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment