#include #include #include using namespace std;
void main(){setlocale(0, "");int a = 100, num, player = 1, correct;while (a > 0){ if (player == 1) { do { cout << "Ваш ход. На столе " << a <<" спичек" << endl; cout << "Сколько спичек вы берете?" << endl; cin >> num; if ((num > 0) && (num <= 10)) { correct = true; } } while (correct != true); } else { if ((a <= 10) && (a > 1)) { num = a - 1; } else if (a == 1) { num = 1; } else { if (num > a) { num = a; } } cout << "Компьютер взял " << num << " спичек" << endl; } a = a - num; if (player == 1) { player = 2; } else { player = 1; }}if (player == 1){ cout << "Вы проиграли" << endl;}else cout << "Вы победили" << endl;system("pause");}