Answer the question
In order to leave comments, you need to log in
Is it possible to apply such a condition?
I have code:
#include <iostream>
#include <conio.h>
using namespace std;
int arr[9];
bool win;
bool proverka()
{
if (arr[0] == 2 && arr[1] == 2 && arr[2]==2)
{
return true;
win = true;
}
else
{
return false;
win = false;
}
}
void output()
{
for (int i = 0; i < 9; i++)//вывод поля
{
cout << " | " << arr[i] << " | ";
if ((i + 1) % 3 == 0)
{
cout << endl;
}
}
}
int main()
{
setlocale(LC_ALL, "Russian");
arr[0] = 2;
arr[1] = 2;
arr[2] = 2;
output();
proverka();
if (proverka())
{
cout << "RAVNO";
}
else
{
cout << "NE RAVNO";
}
_getch();
return 0;
}
if (arr[0] == arr[1] == arr[2])
if (a == b == с)
Answer the question
In order to leave comments, you need to log in
if (arr[0] == arr[1] == arr[2])
Because it is not clear where you got such syntax from.
Try something like this:if (arr[0] == arr[1] && arr[1] == arr[2])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question