Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<random>
- #include<Windows.h>
- using namespace std;
- void kubik(int points)
- {
- switch (points)
- {
- case 1:
- cout << "#-----#\n| |\n| * |\n| |\n#-----#" << endl;
- break;
- case 2:
- cout << "#-----#\n| * |\n| |\n| * |\n#-----#" << endl;
- break;
- case 3:
- cout << "#-----#\n| * |\n| * |\n| * |\n#-----#" << endl;
- break;
- case 4:
- cout << "#-----#\n| * * |\n| |\n| * * |\n#-----#" << endl;
- break;
- case 5:
- cout << "#-----#\n| * * |\n| * |\n| * * |\n#-----#" << endl;
- break;
- case 6:
- cout << "#-----#\n| * * |\n| * * |\n| * * |\n#-----#" << endl;
- break;
- cout << endl;
- }
- }
- int main()
- {
- setlocale(LC_ALL, "rus");
- srand(time(NULL));
- cout << "Поиграешь со мной в кости?" << endl;
- int mypoints = 0, pcpoints = 0;
- bool k = rand() % 2;
- if (k)
- {
- cout << "Ходи первым " << endl;
- }
- else
- {
- cout << "Я хожу первым " << endl;
- }
- int p;
- for (int i = 0; i < 4; ++i)
- {
- for (int x = 0; x < 2; ++x)
- {
- if (k)
- {
- p = rand() % 6 + 1;
- mypoints += p;
- cout << "Тебе выпало: " << p << endl;
- }
- else
- {
- p = rand() % 6 + 1;
- pcpoints += p;
- cout << "Мне выпало: " << p << endl;
- }
- kubik(p);
- }
- if (i < 3)
- {
- if (mypoints > pcpoints)
- {
- cout << "Пока ты лидируешь ";
- }
- else if (mypoints < pcpoints)
- {
- cout << "Догоняй, друг ";
- }
- else if (mypoints < pcpoints)
- {
- cout << "Пока что наравне ";
- }
- cout << mypoints << '-' << pcpoints << endl;
- }
- else
- {
- if (mypoints > pcpoints)
- {
- cout << "Позравляю с выигрышем ";
- }
- else if (mypoints < pcpoints)
- {
- cout << "Я тебя обыграл))) ";
- }
- else if (mypoints < pcpoints)
- {
- cout << "Ничья, сойдёмся на этом";
- }
- cout << mypoints << '-' << pcpoints << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement