Error lvalue required as left operand of assignment c++
<p>The whole program basically just allows the user to move the cursor and if the user is in the given range of coordinates (2,2), the user is allowed to type the input. I have just provided some bits of the code which I thought would be enough for solving the problem.</p>

<p>I don't know what is causing this problem.Can you also explain why is it happening !!    </p>

<pre><code>void goToXY(int ,int);
</code></pre>

<p>Created a function with two ints.</p>

<pre><code>int X = 0, Y = 0;
</code></pre>

<p>Initialised two ints. </p>

<pre><code>if(X = 2 &amp;&amp; Y = 2){
    cin &gt;&gt; input;
}
</code></pre>

<p>This is where the error is(it's above)</p>

<pre><code>void goToXY(int x = 0, int y = 0) {

    COORD c;
    c.X = x;
    c.Y = y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
}
</code></pre>

<p>Here's where I define the function(it's above)</p>