Hey guys! I am recieving this error on the code posted below: "Operator '&&' cannot be applied to operands of type 'int' and 'int'. I do not understand why this is not working. is there a workaround or a better way I should be doing this. Thanks in advance!

C2, A2, B2, D, A, B and C are all int.

if (((C2) = (A2) + (B2)) && (D = A + B + C))
                { 

                }

Recommended Answers

All 4 Replies

What? What are you actually trying to do?

Um, do you really mean to do assignment (=) or do you mean to compar for equality (==) ?
If so, dont you mean

if ((C2 == (A2 + B2)) && (D ==  (A + B + C)))
            { 
            }

In C# use '==' instead of '=' ....simple

Yep, Thanks dude....I am a idiot.

*an idiot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.